Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Checkbox in ListGrid - One selected at any given time

    I am using SmartClient 8.1.

    I have a ListGrid with data source attached. One of the fields is boolean and it gets checked/unchecked for each row according to data it fetches.

    The problem is that I want to allow only one of the check boxes in this column to be checked. All other should be unchecked.

    I call a function to deselect all other checkboxes on the change event of this column. See the following code that only works for the first click.

    Code:
    function deselectAllOtherCheckboxes(value)
    {
    	if (value == true)
    	{
    		srec = table.getSelectedRecord();
    		
    		for (var i=0; i < table.data.getLength(); i++)
    		{
    			rec = table.data.get(i);
    			if (rec.id != srec.id)
    			{
    				rec.checkboxField = false;
    				table.refreshCell(i, 2);
    				table.refreshRow(i);
    			}
    		}
    	}
    }
Working...
X