Categories | Question details Back To List | ||
dropping same item onto treeGrid more than once but onto different nodes Hey, it is possible for a treeGrid to contain multiple instances of the same Row ID? We want to be able to create a treeGrid showing support assignment by relating people to the people they are supporting. A single person may support mulitple others. But we want to preserve the person's ID as the target treeGrid Row ID rather than generate a new Row ID each time that person is dropped onto a new node. Here is the use case: The drag source is a grid containing a list of people. The drop target is a treeGrid representing a hierarchy of people with the support relationship represented by a child node representing the person providing the support which is attached to the person being supported. We would like to drag a certain person, John Doe, from the grid and then drop that person onto a person that he has been associated with (creating a child to that node). Since John can be assigned to multiple people, we need to be able to drop him onto the treeGrid as child to multiple process nodes. This of course creates multiple rows with ID="John's ID" The data is being sent successfully to the underlying table but the treeGrid starts behaving erratically after the first duplicateID is created. Is there a setting that supports a mode allowing non-unique Row IDs in the treeGrid? Much appreciated, and thanks, Max Answer posted by Support on Jun 08, 2009 01:47 >>multiple instances of the same Row ID? Not possible, to work correctly each item need to have an unique ID. >>Is there a setting that supports a mode allowing non-unique Row IDs in the treeGrid? There is no such settings, but with small code adjustment you can use both unique IDs on client side and the same ID on the server side. You can add next code the the page dragContext.prototype.uid=function(a,b){ this.nid=this.sid; this.nid=this.nid+"_"+((new Date()).valueOf()); while (this.tobj.rowsAr[this.nid]) this.nid=this.nid+"_"+((new Date()).valueOf()); return this; } This code defines how new ID will be created after DnD. With above update when you drag item with ID = "Jonh" it will result in new IDs as Jonn_12321341234 Jonn_12321341235 Jonn_12321341236 and etc. So in server side code you can split ID by "_" character, and get true ID for DB operations. |