Is it possible to use the Drag & Drop framework to move rows around (for sorting, basically) in the child bands of a WHDG? I have it working in the parent grid, but am not sure how to get it going in the children.
Thanks
Hi cwaldmann,
It has been some time since your post but in case that you still need assistance I will be happy to help.
If you have achieved parent band drag and drop functionality, implementing this for the child bands should be a matter of accessing the child rows through javascript. This can be done using something similar to:
var grid = $find("WebHierarchicalDataGrid1");
var childBand = grid.get_gridView().get_rows().get_row(0).get_rowIslands(0)[0].get_rows();
If you have any questions or need more help please feel free to show me the code you are using for the desired functionality.
Please let me know if you still need assistance on this matter.
Thanks for pointing me in the right direction. I got it solved.
For those interested, here is my final Javascript code to apply the drag/drop to the rows in the child band:
//apply drag drop to questions (parent band)_ddQuestions = new $IG.DragDropBehavior();_ddQuestions.get_events().addDragMoveHandler(moveQuestion);_ddQuestions.get_events().addDropHandler(dropQuestion);
datagrid = $find("<%= whdgQuestions.ClientID %>")
if (datagrid != null) { datagridrows = datagrid.get_gridView().get_rows(); count = datagridrows.get_length();
for (var i = 0; i < count; i++) { var row = datagridrows.get_row(i).get_element(); _ddQuestions.addSourceElement(row); _ddQuestions.addTargetElement(row);
//apply drag/drop to child questions (child band) if (datagridrows.get_row(i).get_rowIslands(0)[0] != null) { _ddChildQuestions[_ddChildQuestions.length] = new $IG.DragDropBehavior(); _ddChildQuestions[_ddChildQuestions.length-1].get_events().addDragMoveHandler(moveChildQuestion); _ddChildQuestions[_ddChildQuestions.length-1].get_events().addDropHandler(dropChildQuestion);
var childBand = datagridrows.get_row(i).get_rowIslands(0)[0].get_rows();
for (var c = 0; c < childBand.get_length(); c++) { var childrow = childBand.get_row(c).get_element();
_ddChildQuestions[_ddChildQuestions.length - 1].addSourceElement(childrow); _ddChildQuestions[_ddChildQuestions.length - 1].addTargetElement(childrow); } } }}
On another note, is there a good resource for the Javascript part of the API? Your online documentation give me class outlines for the server side objects, but the functions for Javascript are obviously somewhat different. I find myself running the debugger just to look at what the objects and their capabilities are,.
If you need any further assistance on the matter please do not hesitate to ask.
Hi Nikolay
I want to format columns of child bands in WHG like I want to do as (
field.Header.Text = sHeaderText;field.Width = Unit.Pixel(iWidth);field.CssClass = sCSS;field.Hidden = bVisibility;field.DataType = sDatatype;field.DataFormatString = sFormat;)
Thx
Shyam