:: Forum >>

obj.setProperty("selection/index", -1); not working for deselect

obj.setProperty("selection/index", -1); not working for deselecting the rows...
James
Tuesday, May 13, 2008
???

To select or deselect the rows you should use setSelectedRows() method -

grid.setSelectedRows([]);
Alex (ActiveWidgets)
Tuesday, May 13, 2008
when using top.screens.stockList.obj.setSelectedRows([i]).refresh(); not deselecting the rows...it just focusing first row and highlighting...
my problem is :
am using this line(top.screens.stockList.obj.getRowTemplate(i).refresh(); ) at the end to deselct the rows..and it is deselecting but after deselect rows are getting disorder in their color..i.e some consecurive rows are getting grey or white like that..



function clearFindStock(){
document.getElementById("stockInput").value="";
var changeflag=1;
/*alert('UnSelect');*/
for(i = 0; i < top.myRowCount; i++){
if(top.myData[i][2] != '&nbsp;'){
changeflag++;
if((changeflag%2)==1){
top.screens.stockList.obj.getRowTemplate(i).setStyle("background-color", "#EFEFEF;");
}
else{
top.screens.stockList.obj.getRowTemplate(i).setStyle("background-color", "#fff;");
}
//top.screens.stockList.obj.getRowTemplate(i).refresh();
top.screens.stockList.obj.setSelectedRows([i]).refresh();
}

}

}
James
Wednesday, May 14, 2008
James,
For alternating background colors...
shouldn't it be easier to define a new row-property?
Check also posts # 13601 & 11820.
HTH

var obj = new AW.UI.Grid;
obj.setCellText(function(i,j){return j + '-' + i});
obj.setHeaderText(function(i){return 'header-'+ + i});
obj.setColumnCount(4);
obj.setRowCount(15);
obj.setSelectionMode('single-row')
obj.setSelectedRows([0,2,4,6]);

obj.defineRowProperty("Mybackcolor", function(row){
return (obj.getRowPosition(row)%2)==1 ? "#EFEFEF" : "#fff";
});
obj.getRowTemplate().setStyle("background-color", function(){
return this.getRowProperty("Mybackcolor");
});

var button = new AW.UI.Button;
button.setControlText('UnSelect all Rows')
button.setId('a01');
button.onControlClicked = function(){
obj.setSelectedRows([]);
//obj.refresh();
}
document.write(button);
document.write(obj);
Carlos
Wednesday, May 14, 2008

This topic is archived.


Back to support forum

Forum search