laneoc
Posts: 154
|
Posted: 05/13/2013, 12:08 PM |
|
In my editable grid, I'd like to give the user a "check all" button that sets the value of one of the grid elements for each row in the grid.
I am not very skilled in javascript. I've looked around for ways to do this, but if there's a CCS-friendly way to get this done I would like to find out about it.
Anyone?
--Lane
_________________
Lane |
|
|
DataDoIT
|
Posted: 05/13/2013, 1:32 PM |
|
Assuming your editable grid's row checkbox will be the Delete Control...
Place a checkbox called 'CheckBox_SelectAll' in the caption row for your
editable grid. Then add Custom Code for that checkbox's Client On Click
event:
initMyGridElements();
for(var j = 0; j < MyGridElements.length-MyGridEmptyRows; j++) {
if (document.forms["MyGrid"].CheckBox_SelectAll.checked) {
MyGridElements[j][MyGridDeleteControl].checked = true;
}
else {
MyGridElements[j][MyGridDeleteControl].checked = false;
}
}
Where "MyGrid" is the name of your editable grid component.
|
|
|
laneoc
Posts: 154
|
Posted: 05/17/2013, 1:39 PM |
|
I haven't gotten this to work yet, but it seems close.
If the control is "rstatus" (as shown in the IDE), would I substitute "rstatus" for "DeleteControl"? I have a problem in this area currently as I get "ReferenceError: MyGridrstatus is not defined".
Also... I'm interested in a "set all drop-down lists" similar to "check all". Is this on the right track:
initMyGridElements();
for(var j = 0; j < MyGridElements.length-MyGridEmptyRows; j++) {
MyGridElements[j][MyGridrstatus].value = document.forms["MyGrid"].SetAll.value;
}
Sincere thanks for your help.
_________________
Lane |
|
|
DataDoIT
|
Posted: 05/17/2013, 9:10 PM |
|
Replace "MyGrid" with the name of your editable grid on your page in
your project.
|
|
|
laneoc
Posts: 154
|
Posted: 05/17/2013, 10:18 PM |
|
The MyGrid substitution is understood. I am not clear about the substitution for "DeleteControl".
LO
_________________
Lane |
|
|
DataDoIT
|
Posted: 05/18/2013, 12:23 AM |
|
For your Editable Grid, choose the Data tab, and in those property
settings you'll see an entry for Delete Control. Set that to your row's
checkbox. Then CodeCharge will refer to that element as:
MyGridDeleteControl
or
SpongeBobDeleteControl
|
|
|
Waspman
Posts: 948
|
Posted: 11/11/2013, 9:47 AM |
|
It works, but why does it only check the top 4 checkboxes?
cheers
Tony
_________________
http://www.waspmedia.co.uk |
|
|
Waspman
Posts: 948
|
Posted: 11/11/2013, 9:55 AM |
|
haha! This is mad. It's fixed itself! all CB's are now being checked.
I love CCS!
_________________
http://www.waspmedia.co.uk |
|
|