Hello , trying to figure out how to manipulate datasource locally by this guide
https://ej2.syncfusion.com/angular/documentation/diagram/data-binding/#local-data
Assump my node :
export interface INode {
stepId: string;
meta: {title: string, color: string, selected: boolean};
parentId: number[];
}
and i use
public layout: LayoutModel = {
type: 'ComplexHierarchicalTree'
}
1 . Clicking on the Node , need to select it , + it connectors , + it parent Nodes programmatically ( changing it color / properties ) ?
2. How to use setNodeTemplate ?
3. What the best approach changing node properties ?
4. How to create 2 layers with "selected" / "unselected" data from datasource and manage it ?
5. How to CRUD datasource locally without rebuild everytime DataSourceSettings ?
6. Also it will be great to know how to do responsive diagram ?
|
Clicking on the Node, need to select it, + it connectors, + it parent Nodes programmatically ( changing its color / properties ) ? |
By using the nodes inEdges and OutEdges property. We can able to get the parent and child node and we can change the appearance of the node. Please refer to the below sample.
| |
|
How to use setNodeTemplate ? |
We have added a setNodeTemplate Please refer to the below sample how to use setNodeTemplate in the diagram
| |
|
What the best approach changing node properties ?
Through (selectionChange) event ?
or (click) event ?
or selectedItems ? |
We can use selection change for changing the node properties in the diagram. Please refer to the below sample and code snipper to change the node properties based on condition.
| |
|
How to create 2 layers with "selected" / "unselected" data from datasource and manage it? |
We can able to add layers to the diagram and can able to move the required objects into the specified layers. Using the layer visible property we can able to show or hide the layer in the diagram and Please refer to the documentation link for your reference.
Documentation Link: https://ej2.syncfusion.com/angular/documentation/diagram/layers/ | |
|
How to CRUD datasource locally without rebuild everytime DataSourceSettings ? |
We can update the datasource locally, by modifying the existing value in the datasource. If we try to reassigning the datasource with the new data source. Then the diagram will rerender whenever the new datasource gets initialized. | |
|
Also it will be great to know how to do responsive diagram ? |
when the viewport width goes below 550 pixels then the symbol palette will render only when clicking on the icon. We have added the sample link and a video link to demonstrate how to do a responsive diagram.
|
Thank you Sivakumar for your quick reply !
Last one question , my
I found this example but not works for me ..
https://ej2.syncfusion.com/angular/documentation/common/how-to/lazy-loading-support/
tried bellow adapters ..
this.dataSourceSettings = {
id: 'stepId',
parentId: 'parentId',
dataSource: new DataManager(dataSource),
adaptor: new ODataAdaptor() // new Adapter () // new JsonAdaptor //
};
This is my module hierarchy
{
path: RoutingEnum.CONFIGURATION,
loadChildren: () => import('./configuration/configuration.module').then((m) => m.ConfigurationModule),
},
ConfigurationModule -> MainPageRoutingModule -> MainPageModule -> AppRoutingModule -> AppModule
import {WorkflowTransitionDiagramComponent} from './components/workflow-transition-diagram/workflow-transition-diagram.component';
import {DiagramModule} from '@syncfusion/ej2-angular-diagrams';
@NgModule({
imports: [
CommonModule,
ConfigurationRoutingModule,
LvMapModule,
FormsModule,
LvFormModule,
MatTabsModule,
ShareModule.forRoot(),
MessageModule,
MatMenuModule,
MatDialogModule,
MatCheckboxModule,
MatTooltipModule,
MatListModule,
ClipboardModule,
FormsModule,
ReactiveFormsModule,
MatIconModule,
DragDropModule,
InfraModule,
DiagramModule,
FormlyModule.forChild(FORMLY_CUSTOM_CONFIG),
MatExpansionModule,
TranslateModule.forChild({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
}),
],
declarations: [
ConfigurationComponent,
ModulesMappingComponent,
ConfigurationJointsComponent,
ModulesLocateComponent,
ConfigurationFormsComponent,
ModulesPressureTestComponent,
ConfigurationProjectComponent,
ConfigurationAssetsComponent,
GisGridWithFullScreenComponent,
GridWithFullScreenComponent,
AlertTypeListComponent,
AlertTypeEditorComponent,
AlertTypeListCardComponent,
AlertTypeEditorCriterionComponent,
AlertTypeEditorCardComponent,
ConnectGISLayerComponent,
ConfigurationWorkUnitComponent,
ReconciliationComponent,
ReconListComponent,
ReconEditorComponent,
OqVendorsComponent,
OqComponent,
OqTasksComponent,
OqTaskEditorComponent,
SystemMappingComponent,
ConfigurationTestComponent,
MainSharedContentComponent,
LiveListsComponent,
LiveListEditorComponent,
FieldsTagsComponent,
FieldsTagsEditorComponent,
SharedListPreviewComponent,
SharedListEditorComponent,
ConfigurationVersionManagerComponent,
DashboardsComponent,
DashboardsEditorComponent,
DashboardsEditorFieldComponent,
DashboardsEditorCardComponent,
DashboardsEditorFieldRepeaterComponent,
WorkflowStepsComponent,
WorkflowStepEditorComponent,
WorkflowsComponent,
WorkflowEditorComponent,
WorkflowTransitionEditorComponent,
WorkflowTransitionEditorDialogComponent,
WorkflowTransitionDiagramComponent
],
exports: [ModulesMappingComponent, ConfigurationComponent],
providers: [
ConfigurationService,
SystemMappingGuard,
GisGuard,
{
provide: MAT_RIPPLE_GLOBAL_OPTIONS,
useValue: {
disabled: true,
},
},
AlertsService,
{
provide: FORMLY_CONFIG,
multi: true,
useFactory: registerTranslateExtension,
deps: [TranslateService],
},
],
entryComponents: [ConfigurationTestComponent],
})
export class ConfigurationModule {
}
Whats the thing i'm missing ?
Thank you again :) .
Hi again ! Please provide me example for ...
<ej-diagram [dataSourceSettings]></ej-diagram>&
dataSourceSettings - i'm using locally JSON data binding&
with Lazy loading Angular Component ( example-diagram.component.ts => example-diagram.module.ts )
that exist under app.module.ts
{
path: 'example-diagram',
loadChildren: () => import('./example-diagram.module').then((m) => m.ExampleDiagramModule),
}