BPMN Palettes

One small confirmation, is the nodes on left hand side palletes are added in the order as defined for each section?

eg: myPaletteLevel1.model = $(go.GraphLinksModel,
copiesArrays: true,
copiesArrayObjects: true,
nodeDataArray: [
// -------------------------- Event Nodes
{ key: 101, category: “event”, text: “Start”, eventType: 1, eventDimension: 1, item: “start”},
{ key: 102, category: “event”, text: “Message”, eventType: 2, eventDimension: 2, item: “Message”}, // BpmnTaskMessage
{ key: 103, category: “event”, text: “Timer”, eventType: 3, eventDimension: 3, item: “Timer”},
{ key: 104, category: “event”, text: “End”, eventType: 1, eventDimension: 8, item: “End”},
{ key: 107, category: “event”, text: “Message”, eventType: 2, eventDimension: 8, item: “Message”},// BpmnTaskMessage
{ key: 108, category: “event”, text: “Terminate”, eventType: 13, eventDimension: 8, item: “Terminate”},
// -------------------------- Task/Activity Nodes
{ key: 131, category: “activity”, text: “Task”, item: “generic task”, taskType: 0},
{ key: 132, category: “activity”, text: “User Task”, item: “User task”, taskType: 2},
{ key: 133, category: “activity”, text: “Service\nTask”, item: “service task”, taskType: 6},
// subprocess and start and end
{ key: 134, category: “subprocess”, loc: “0 0”, text: “Subprocess”, isGroup: true, isSubProcess: true, taskType: 0 },
{ key: -802, category: “event”, loc: “0 0”, group: 134, text: “Start”, eventType: 1, eventDimension: 1, item: “start” },
{ key: -803, category: “event”, loc: “350 0”, group: 134, text: “End”, eventType: 1, eventDimension: 8, item: “end”, name: “end” },
// -------------------------- Gateway Nodes, Data, Pool and Annotation
{ key: 201, category: “gateway”, text: “Parallel”, gatewayType: 1},
{ key: 204, category: “gateway”, text: “Exclusive”, gatewayType: 4},
{ key: 301, category: “dataobject”, text: “Data\nObject”},
{ key: 302, category: “datastore”, text: “Data\nStorage”},
{ key: 401, category: “privateProcess”, text: “Black Box”},
{ key: “501”, “text”: “Pool 1”, “isGroup”: “true”, “category”: “Pool” },
{ key: “Lane5”, “text”: “Lane 1”, “isGroup”: “true”, “group”: “501”, “color”: “lightyellow”, “category”: “Lane” },
{ key: “Lane6”, “text”: “Lane 2”, “isGroup”: “true”, “group”: “501”, “color”: “lightgreen”, “category”: “Lane” },
{ key: 701, category: “annotation”, text: “note”}
] // end nodeDataArray

This is the code in the sample for level1 accordian,
Does the order in which the LHS nodes are drawn is same as above?

If that is what you want, you need to set the GridLayout.sorting property of the Palette.layout, which is a GridLayout, to:

    myDiagram.layout.sorting = go.GridLayout.Ascending;

If it isn’t already set that way, of course.

Added the property myDiagram.layout.sorting = go.GridLayout.Ascending; still the order changes.

defination:{ key: 206, category: "activity", taskType: 6, isLoop: true, isSubProcess: true, isTransaction: true, text: "Service",name: "Service", item: "service task" }, { key: 205, category: "activity", taskType: 5, isParallel: true, text: "Send Msg",name: "Send Msg", item: "Send Msg Task" }, {key: 204, category: "activity", taskType: 4, isSequential: true, name: "Script", "mond_description": "", item: "scriptTask","OnJavaScript": "","OnGroovyScript":"", "mond_script": "","setStepStatusTo": "", "setProcessStatusTo": "",operatorConstant: bpmOperatorConstants.BPM_SCRIPT}, {key:203,category: "activity",taskType: 3,isAdHoc: true,name: "Manual",item: "manualTask",operatorConstant: bpmOperatorConstants.BPM_MANUAL }, { key: 3, category: "activity", taskType: 7, text: "Business Rule Task",name: "Business Rule Task", item: "Business Rule Task" }, { key: 4, category: "activity", taskType: 2, text: "User Task",name: "User Task", item: "User Task", isCall: true}, { key: 84, category: "activity", taskType: 2, text: "User Task", name: "User Task", item: "User Task",isCall: true, isLoop: true, isParallel: true, isSequential: true }, { key: 1, category: "activity", taskType: 1, text: "Receive Task",name: "Receive Task", item: "Receive Task" }, { key: 6, category: "activity", taskType: 6, name: "Call", text: "Call\nActivity", "mond_description": "", item: "callActivity", operatorConstant: bpmOperatorConstants.BPM_CALL_ACTIVITY } ] // end nodeDataArray });

I have defined service task as the first entry in accordin but as seen the image the first node is call activity task, i want nodes to be added in the accordian same as the order we have defined it … how can i achieve that

Is “myDiagram” in your code referring to your Palette? You need to modify your instance(s) of Palette, not the main Diagram where the current diagram is being shown/edited.

so if i go according to BPMN example in go js samples, it will be myPaletteLevel1.layout.sorting = go.GridLayout.Ascending; ???

First you must spell “myPaletteLevel1” correctly.

Second, that code to initialize the Palettes already assigns the Diagram.layout to a GridLayout that uses keyCompare as the GridLayout.comparer. That is why the items are always ordered by their key values.

Third, GridLayout.sorting defaults to Ascending, so you don’t need to set it.

So you could either change the key values to be in the order that you would like, or you can remove that comparer from the layout.