3.2.0

using obj.setSelectedRows([]);

obj.setSelectedRows([]);
how to clear selected rows for CheckedItem?
vanya
April 4,
i select the row on click on checkbox on the selector

so im looking for a solution wherein i can
deselect the row,the checkbox should also uncheck

pls help
vanya
April 4,
If you are using "multi-row-marker" selection mode the checkbox will be cleared automatically when you unselect the row. Otherwise you have to refresh the selector.
Alex (ActiveWidgets)
April 4,
Alex,
After resetting grid with setSelectedRows([]), the grid's checkboxes still remain checked.

In the following example, "bef:" shows 5,6, and "after:" shows nothing. However, grid still shows checkboxes of rows 5 and 6 checked.

alert("bef:" + obj.getSelectedRows());
obj.setSelectedRows([]);
obj.refresh();
alert("after:" + obj.getSelectedRows());

I guess the question is how to check or uncheck checkboxes in a grid programmatically? (apparently, refresh does not seem to help)
Anand
April 4,
Alex...
Anand has explained the problem i am facing correctly

when i use
obj.setSelectorTemplate(new AW.Templates.CheckedItem);
obj.setSelectedRows([]);
works the way Anand as best discribed

however
with "multi-row-marker" as selection mode
check boxes uncheck with obj.setSelectedRows([]);
but with this the check boxes come on the first column "not" the selector

1)is there a way to get the checkboxes on the selector with "multi-row-marker" ?
2)is there a way to uncheck the check boxes in case of CheckedItem ?

in need of the ans to one of the two

shilpa
April 5,
to add
i tried refreshing the selector using
obj.getSelectorTemplete(row).refresh();
{here row is the row number whoz checkboxz i wish to deselect}

but this doesn work,the row refreshes with the checkbox selected
is there a Clear Selector function?

i have been stuck with this for 2 days now
pls help
vanya
April 5,
Here is the example using CheckedItem template in multi-row-marker selection mode.

http://www.activewidgets.com/grid.howto.selections/selecting-rows-with-checkboxes.html

use this code to remove the CheckedItem template from the first column and add it to the row selector -

obj.setCellTemplate(new AW.Templates.Text);
obj.setSelectorTemplate(new AW.Templates.CheckedItem);
obj.setSelectorVisible(true)
obj.setSelectorWidth(30);

Alex (ActiveWidgets)
April 5,
I am confused. :(

I am using multi-row-marker. obj.setSelectedRows([]) does not work for me.

this is what am doing:
1. On a gird, displaying multiple rows. because of multi-row-marker, it displays checkbox in the first column. (which is fine)
2. User selects rows 5 and 6. checkboxes of rows 5 and 6 show checked.
3. now the user hits cancel and chooses to get fresh set of data to show in grid.
4. the same grid object that showed the prev set of details is now required to show the new set. the program does "obj.setCellText(arr);" It does show the new set, only with rows 5 and 6 selected.

I have to get those rows unselected. Setting obj.setSelectedRows([]) does not help.

Looks like the gird needs to be completely reset. just don't know how to do this.any ideas will be greatly appreciated.

( i tried with a Table model for the grid, and used obj.setCellModel(table). still the same issue)
Anand
April 5,
I cannot programmatically select or unselect rows in a grid that uses multi-row-marker.

obj.setCellText(arr);
obj.setSelectedRows([1,2,3]);
obj.refresh();

the above code runs after constructing obj as Grid. on the user-interface, i dont see rows 1,2,3 checked. but obj.getSelectedRows() returns an array of 1,2,3.

this is the problem. somehow, programmatically, i can not select or unselect checkboxes in a grid that uses multi-row-marker.
Anand
April 5,
I am having a similar problem with moving data from one grid to another. The typical thing of having two grids with a >> and << button. In the client side script I copy the selected items from on array to the other and then reset the grid.

// Do full refresh of the grids
dGrid.setRowCount(dGrid.sourcearray.length);
dGrid.setCellText(dGrid.sourcearray);
dGrid.refresh();

sGrid.setRowCount(sGrid.sourcearray.length);
sGrid.setCellText(sGrid.sourcearray);
sGrid.refresh();

But no matter what I do the new grid contains rows selected. I have tried pretty much all I can think of to reset the selection but nothing works. Currently I am trying:

dGrid.clearSelectedModel();
dGrid.setSelectedRows([]);
sGrid.clearSelectedModel();
sGrid.setSelectedRows([]);
dGrid.refresh();
sGrid.refresh();

Any answers would be apprieciated as I am evaluating the grid for use in a new project and currently this is stopping me using your libraries.
Joe Craig
May 2,
I am having similar issue when I do an addRow from one grid to another any grid set to use multi-row-marker the first row added everythime is checked and I cannot get it unckecked, any help you can provide would be great.

opener.document.forms[0].definitionChanged.value="true";

var j = opener.criteriaGridData.length;
//alert("size of gridData is " + j);
var data=gridData[rowIndexArray[i]];
//alert(data);
opener.criteriaGridData[j] = data;
// Set selection column to empty value
opener.criteriaGridData[j][0]="";
// Set trailing columns from popup (exp period end date and
// cert number) to empty strings since they will not be sourced
// from the contract popup;
opener.criteriaGridData[j][4]="";
opener.criteriaGridData[j][5]=0;

opener.criteriaGridData[j][0].checked=false;
opener.criteriaGridObj.setCellData(opener.criteriaGridData);
opener.criteriaGridObj.addRow(j);
Eric York
June 27,

This topic is archived.

See also:


Back to support forum