开发者

Viewing source after adding new row in <table>

开发者 https://www.devze.com 2023-04-11 00:45 出处:网络
I am creating new row in <table> through javascript. Row is added but I cannot view source code of the newly created row through Developer Tools in internet Explorer. I can view it through fireb

I am creating new row in <table> through javascript. Row is added but I cannot view source code of the newly created row through Developer Tools in internet Explorer. I can view it through firebug in Firefox.

Problem is I am working on drag and drop in dojo of these rows. Any rows that are already in the table can be drag and drop but when I create a new row then after generation new row could not be drag and drop becaus开发者_开发百科e its not added to the source code and dojo could not find that row to be dragged.

This is the code for new row creation.

var tbody = document.getElementById('myTable').getElementsByTagName("tbody")[0];
var row = tbody.insertRow(rowCount);
var cell1 = row.insertCell(0);

var element2 = document.createElement('input');    
element2.value = "valueHere";
element2.type = "text";

cell1.appendChild(element2);
row.appendChild(cell1);
tbody.appendChild(row);

When I try to drag new row Dojo gives error

'getItem(...).type' is null or not an object


Most likely after new row is added you need to reinitiate you plugin


There was a problem that dojo was not updating it draggable nodes. Also by viewing source was not displaying newly created rows. Dojo dnd source has a property called autoSync. See dojo.dnd.Source api. Its by default set to false but enabling it true does the work. It automatically syncs the nodes and all newly generated nodes was able to drag and drop.

0

精彩评论

暂无评论...
验证码 换一张
取 消