I have 11 grids on a page that i'm dragging and dropping between using v15.1 of the ig controls. I have the drag and drop set to use an anchor in a TemplateDataField in the grids. When i drop i get the id of the dropped record, pass it to the back end in a hidden field and rebind all the girds. This works pretty well.
The problem now is getting the rest of the values in the row and passing them along. The other values are in columns using editor providers. Really i need to drag the row, not just an anchor, and have the row's data available to me.
Thanks
Ten
function app_loaded() { _dd = new $IG.DragDropBehavior(); _dd.get_events().addDropHandler(drop); var ids = $('#<%=Block0.ClientID%>').val().split(","); for (var i = 0; i < ids.length; i++) { var item = $get("source-" + ids[i]); if (item != null) { _dd.addSourceElement(item, true); } } _dd.addTargetElement($get("dropDestination"), true); _dd.addTargetElement($get("dropDestination1"), true); _dd.addTargetElement($get("dropDestination2"), true); _dd.addTargetElement($get("dropDestination3"), true); _dd.addTargetElement($get("dropDestination4"), true); _dd.addTargetElement($get("dropDestination5"), true); _dd.addTargetElement($get("dropDestination6"), true); _dd.addTargetElement($get("dropDestination7"), true); _dd.addTargetElement($get("dropDestination8"), true); _dd.addTargetElement($get("dropDestination9"), true); _dd.addTargetElement($get("dropDestination10"), true);... function drop(sender, eventArgs) { var source = eventArgs.get_manager().get_source().element; var id = source.id.split("-")[1]; var ele = $('#' + source.id) var sourcediv = ele.closest('.DropDestination') $get("<%= hdnitemid.ClientID %>").value = id; $get("<%= hdnBlockFrom.ClientID %>").value = sourcediv.attr("id"); $get("<%= hdnBlockTo.ClientID %>").value = eventArgs.get_manager()._curTargs[0].element.attributes["id"].value; var targetgrid = $find(eventArgs.get_manager()._curTargs[0].element.attributes["id"].value); var sourcegrid = $find(sourcediv.attr("id")); $("#<%= Block1Click.ClientID %>")[0].click(); }
....
<Columns> <ig:TemplateDataField Key="ID" Header-Text="Worker" > <ItemTemplate> <a href="javascript:void(0);" id="sourceblock1-<%# Eval("Id") %>"> <%# Eval("EmployeeName") %></a> </ItemTemplate> </ig:TemplateDataField> <ig:BoundDataField Hidden="true" DataFieldName="EmployeeName" Key="EMPNAME" Header-Text="Worker"/> <ig:BoundDataField DataFieldName="EskInt" Key="EskInt" Hidden="true" /> <ig:BoundDataField DataFieldName="EmployeeJustName" Key="EmployeeJustName" Hidden="true" /> <ig:BoundDataField DataFieldName="Workplace" Key="Workplace" Header-Text="Workplace" /> <ig:BoundDataField DataFieldName="DeployFunction" Key="DeployFunction" Header-Text="Function" /> </Columns>...
Hello,
My suggestion is to create a field (new column) that will combine all cell values from the row into one, and you can pass this combined value on drag/drop. This value can be filled on WebDataGrid_InitializeRow server event. If you don't want this column to be shown, then you can hide it. The value format could be splitted with "|" (Example "1|John doe|27 years old|21.10.1989")
Let me know what do you thing of this approach.
That's kinda what i ended up doing, on the link i put in a attribute rowdata="" then i went and found and updated that on the exit edit mode. This is really a bad solution, i'm not sure if it's the drag and drop or how i'm using it but there should be access to the row of the grid. Here is my code for the next person looking for this... <ItemTemplate> <a href="javascript:void(0);" id="sourceblock1-<%# Eval("Id") %>" rowdata="<%# Eval("Workplace").ToString() + ", " + Eval("DeployFunction").ToString() %>"> <%# Eval("EmployeeName") %></a> </ItemTemplate>function drop(sender, eventArgs) { var source = eventArgs.get_manager().get_source().element; var id = source.id.split("-")[1]; var data = id +','+ source.getAttribute("rowdata"); var ele = $('#' + source.id) var sourcediv = ele.closest('.DropDestination') $get("<%= hdnitemid.ClientID %>").value = data; $get("<%= hdnBlockFrom.ClientID %>").value = sourcediv.attr("id"); $get("<%= hdnBlockTo.ClientID %>").value = eventArgs.get_manager()._curTargs[0].element.attributes["id"].value; var targetgrid = $find(eventArgs.get_manager()._curTargs[0].element.attributes["id"].value); var sourcegrid = $find(sourcediv.attr("id")); $("#<%= Block1Click.ClientID %>")[0].click(); }function ExitEditMode(sender, eventArgs) { var Workplace = (eventArgs.getCell().get_row().get_cellByColumnKey('Workplace').get_value() * 1); var DeployFunction = (eventArgs.getCell().get_row().get_cellByColumnKey('DeployFunction').get_value() * 1); var id = eventArgs.getCell().get_row().get_cellByColumnKey('ID'); var ele = id.get_element(); var nodes = ele.childNodes; if (nodes.length > 0) { for (i = 0; i < nodes.length; i++) { if (ele.childNodes[i].setAttribute != undefined) ele.childNodes[i].setAttribute("rowdata", Workplace + "," + DeployFunction) } } }
Thank you for sharing this knowledge with all community members.