The question on how to change id

Develop and Deploy Cross-Browser Web Apps .

The question on how to change id

Postby Sergei » Tue Aug 06, 2013 4:26 am

There is a need to change the id in all cells TreeGrid.
Let the name of the table 'ctl_treegrid14'. I change the id (and _serialId) in all cells of this ['ctl_treegrid14'] (for example it was - {"value": "row_1 col_1", "id": "c_a"}, is now- {"value": "row_1 col_1 "," id ":" Cd$_col1_a2459693884 "}), just as I make necessary changes in cellMap (colMap, rowMap). But I do not know how to promote changes in the Html object? Use of this['ctl_treegrid14'].Refresh() restores the old links to the id in cellMap (colMap, rowMap), although stores in the cells (this is probably due to the team new box(o).Render() in the source code refresh()). It is difficult for the decision.
How do I change the correct id?
Sergei
 
Posts: 31
Joined: Sat Apr 27, 2013 9:48 am

Re: The question on how to change id

Postby Sergei » Wed Aug 07, 2013 7:40 am

It seems it turned out:
var old_id='c_a';
val new_id='Cd$_col1_a2459693884';
var ns=this['ctl_treegrid14'].get(0);
var tab_ind=ns.$domId.substr(ns.$domId.indexOf(':'));
var pref1=ns.box.$Keys.CELL+tab_ind;
var pref2=ns.box.$Keys.CELLA+tab_ind;
if(document.getElementById((pref1+new_id)||"")==null){
document.getElementById((pref1+old_id)||"").id=pref1+new_id;
document.getElementById((pref2+old_id)||"").id=pref2+new_id;
};
Sergei
 
Posts: 31
Joined: Sat Apr 27, 2013 9:48 am

Re: The question on how to change id

Postby support » Sun Aug 11, 2013 12:45 am

Use updateCellByRowCol or updateCell function.
support
 
Posts: 352
Joined: Sat Apr 27, 2013 9:22 am

Re: The question on how to change id

Postby Sergei » Thu Aug 15, 2013 2:29 am

Change id with updateCellByRowCol not work, because cellMap is not changed (ie _serialId remains the same and the key cell is also the same):
Class('App', 'xui.Com',{
Instance:{
initialize : function(){
this.autoDestroy = true;
this.properties = {};
},
iniComponents : function(){
var host=this, children=[], append=function(child){children.push(child.get(0))};
append(
(new xui.UI.TreeGrid)
.setHost(host,"ctl_TreeGrid1")
.setGridHandlerCaption("Name")
.setRowHandlerWidth(80)
.setHeader([{id:"col1", caption: "Age", width: 40, type: "number"},{id:"col2", caption:"Full-time", width: 90, type:"checkbox"}])
.setRows([{id:"row1",caption:'Jack' ,cells:[23, true],sub:[{id:"row11",caption:'Tom11' ,cells:[241,true]},{id:"row12",caption:'Box11' ,cells:[251]}]},{id:"row2",caption:'John' ,cells:[32],sub:[{id:"row21",caption:'Tom' ,cells:[24]},{id:"row22",caption:'Box' ,cells:[25]}]}])
);

append(
(new xui.UI.SButton)
.setHost(host,"ctl_sbutton1")
.setLeft(250)
.setTop(30)
.setCaption("click me")
.onClick("_ctl_sbutton1_onclick")
);

return children;
},

events : {},
_ctl_sbutton1_onclick : function (profile, e, src, value) {
var uictrl = profile.boxing(), ns=this;
var grid = ns.ctl_TreeGrid1;
grid.updateCellByRowCol('row1' , 'col1' ,{id:'dddd'});
alert(_.serialize(grid.getRowbyRowId('row1','data')));
alert(_.serialize(grid.getRowbyRowId('dddd','data')));
}
}
});

I got it in a way that I have indicated in the first post.
Sergei
 
Posts: 31
Joined: Sat Apr 27, 2013 9:48 am


Return to CrossUI for Web Apps

Who is online

Users browsing this forum: No registered users and 0 guests

cron