View Full Version : Possible bug using XMLDataModel for a Drag & Drop grids

8 Mar 2007, 11:14 AM
I think XMLDataModel assumes that it will always contain atleast one element:

createNode: function(xmlDoc, id, colData){
var template = this.data[0].node;
var newNode = template.cloneNode(true);
return newNode;

Which is a problem when when using it to populate a Drag & Drop grid, since moving elements from one list to another could cause a list to be empty at some point.

I ended up subclassing XMLDataModel and overriding createNode() to use a member var for template and parentNode. It works, but I wasn't sure if perhaps there's a better way that I should be doing this?