|
ludwigl
|
 |
« on: December 17, 2009, 06:56:40 AM » |
|
Hello,
in case rows are added in a treegrid to a group row, which has not been expanded before, the method toggle duplicates the previously added rows. Here is an example:
iniComponents:function(){ // [[code created by jsLinb UI Builder var host=this, children=[], append=function(child){children.push(child.get(0))};
append((new linb.UI.TreeGrid) .host(host,"treegrid3") .setDock("none") .setLeft(140) .setTop(20) .setWidth(420) .setHeight(220) .setRowNumbered(true) .setHeader([{"id":"col1", "width":80, "type":"label", "caption":"col1"}, {"id":"col2", "width":80, "type":"label", "caption":"col2"}, {"id":"col3", "width":80, "type":"label", "caption":"col3"}, {"id":"col4", "width":80, "type":"label", "caption":"col4"}]) .setRows([{"cells":[{"value":"row3 col1"}, {"value":"row3 col2"}, {"value":"row3 col3"}, {"value":"row3 col4"}], "sub":[["sub1", "sub2", "sub3", "sub4"]], "id":"c"}]) .onRowSelected("_treegrid3_onrowselected") );
append((new linb.UI.Button) .host(host,"button5") .setLeft(80) .setTop(250) .setCaption("Insert Row") .onClick("_button5_onclick") );
return children; // ]]code created by jsLinb UI Builder }, _treegrid3_onrowselected:function (profile, row, src) { alert(row.id); }, _button5_onclick:function (profile, e, src, value) { this.treegrid3.toggleRow("c", false); this.treegrid3.insertRows([{id:"bla", cells:["r", "r","r","r"] }], "c"); this.treegrid3.insertRows([{id:"bla2", cells:["r2", "r2","r2","r2"] }], "c"); this.treegrid3.toggleRow("c", true);
},
If the button "insert Row" is clicked, without expanding row 1 (ID:"c") before, the row IDs returned in _treegrid3_onrowselected are not correct.
If you check the rowmap of the treegrid, you will find out that the rows "bla" and "bla2" still exist, but 2 new rows have been created and these are returned in the _treegrid3_onrowselected function.
Workaround is to expand row 1 before inserting the new rows.
It would be great if this bug could be fixed.
With best regards,
Ludwig
|