Selecting rows of parts

I am not able to select the rows of table

That sounds like a different question from swapping rows.

Can you tell us what you want to happen? What actions do you want users to perform then?

I am not able to drag the rows of table ,
and if i am not able to do that then i will not be able to swap the position also.

Any solution?

I still don’t know what you want. Could you please describe how it should look and what actions the user is permitted to perform? And what the user is not permitted to perform either on the selection or on individual parts?

In table layout for list we define item template.
Now i have to do two operations in the list .

  1. Drag a row and move to other row and both the row will swap positions.
  2. Delete the row, the delete icon should come on hovering the row and once you click on that the row will be deleted and the other rows will shift.

List implementation is like the array in which we can add at end only.
By default 3 empty rows come once those are occupied and we drag anothor product in the list it will create a new node add it in the last and place the product in it.

Wait – you were talking about TableLayout and yet now you mention Panel.itemTemplate. Those are completely different things. The former is a diagram Layout (or group member layout) of Parts or Nodes and Links; the latter is a PanelLayout of GraphObject elements in a Panel.

The code I gave you in Move rows of table to swap positions - GoJS - Northwoods Software (nwoods.com) assumed you were using TableLayout and had rows of Parts.

If you want code that swaps items in an Array, you can do that just by modifying the Array – call Model.removeArrayItem and Model.insertArrayItem twice, all within a single transaction.

I am using table layout only.
In table layout we have that property of itemtemplate.

$(go.Panel, 'Table',
                        {
                            name: 'POSITIONS_CONTAINER_DATA',
                            defaultRowSeparatorStroke: 'lightgray',
                            defaultRowSeparatorStrokeWidth: 1,
                            stretch: go.GraphObject.Fill,

                            itemTemplate: this.setupListRowContainerTemplate()
                        },
                        new go.Binding('itemArray', 'positions')
                    )

Like this

OK, then you might be interested in this sample:

Note how fields/rows can appear selected and that the user can “Delete” the selected row(s).

Here’s a sample that lets the user drag fields/rows up and down:

Oh – wait! That sample doesn’t support having the dropped-onto row/field be moved to where the dragged row/field came from. The sample only does an insert. You’ll need to adapt the code so that it also moves the row/field that comes after the insertion point.

A post was split to a new topic: Selecting different rows programmatically