:: Forum >>

Checkbox problem..

Hi, please have a look at the following code snippet:
<script>
var obj = new AW.UI.Grid;
obj.setCellText("a");
obj.setHeaderText("header");
obj.setColumnCount(10);
obj.setRowCount(100);
obj.setCellEditable(true);
document.write(obj);
</script>

It's supposed to print editable cells populated with the text "a" for 100 rows. The modified data will still be there if we edit a particular cell and scroll to the bottom of the grid.

The problem is, when I try to modify the above coding, set the cell text to a check box like:
obj.setCellText("<input type="checkbox" />);
It generates a lot of check boxes and I tried to check one of them and scrolled downward, then go back to the top again and the original check box remained unchecked.

One behavior of the grid I've observed is, if there are a lot of rows/data being populated, and if we try to scroll through the grid, the grid itself will flash and freeze for a while, is it trying to reload all the data stored in javascript? How do I tackle the check box problem, so that it can "remember" the users' action? Many thanks.
Foo
Wednesday, February 7, 2007
The grid removes the rows which scroll out of sight (otherwise everything will be very slow with large number of rows) so your checkbox state will be lost unless you save it somehow. There are two cell templates - AW.Templates.Checkbox and AW.Templates.CheckedItem which do this automatically and linked to cell value property.
Alex (ActiveWidgets)
Wednesday, February 7, 2007
Hi,

I have the same problem than Foo. When I tried to check one and scrolled down, then go back to the top the check box is unchecked.

I tried to use the templates AW.Templates.Checkbox and AW.Templates.CheckedItem but it doesn't work.

Could you help me please?

Thanks.

Lyne
Wednesday, February 7, 2007
Hi:
I have grid with data:
var obj = new AW.UI.Grid;
var chb = new AW.Templates.Checkbox;
var iwCells=[
<loop>['data1'],['data2'],['data3'],['data4']; </loop
];
var checkBoxValues=[
<loop>
['1001'],['2999'],[2332'],['2232']; </loop>
]

// next
obj.setSize(...);
obj.setHeaderText(iwHeader);
obj.setCellText(iwCell);
***
obj.set(chb,0);


The question is:
How can embed checkbox values into my AW?
with my function onclick
function setCheck(arg1,arg2) {
     var f=self.document.forms[0];
     var chb=Trim(f.checkboxvalues.value);
     if(f.chkbox[arg2].checked==true ) {
     if( chb.length<1) chb=arg1;
         else chb=chb+','+arg1;
     } else {
     var i = chb.indexOf(arg1);
         if( i !=-1) {chb=chb.substring(0,i)+chb.substringi+arg1.length+1,chb.length); }
     } // the end of IF
        f.checkboxvalues.value=chb;
}

Thanks in advance.
al.morua
Wednesday, February 7, 2007

This topic is archived.


Back to support forum

Forum search