coco
February 13, 2013, 2:21pm
#1
Hello,
I would like to check first if there are any rows checked and if there aren’t then alert the user that they must select at least one.
I have tried this:
...
var changes = myGrid1.getCheckedRows(9);
alert(changes);
if (changes !== 'undefined' && changes !== null) {
alert("changes not null"+changes);
...
But, it doesn’t work. If I don’t select any rows, it still gets passed the “if” statement even though there is no rowid checked.
How can I check first if any rows are checked before doing something with the checked rows ids?
Many thanks in advance for your help!
Cheers,
sematik
February 13, 2013, 4:00pm
#2
Please, try to use:
if (changes!=null) {
instead of :
if (changes !== 'undefined' && changes !== null) {
coco
February 13, 2013, 10:20pm
#3
Hello,
I have given that a try, but it still, even when there are no checked boxes, finds “changes != null” as true and does the code. I have tried “alert changes” and it is empty. So, I don’t know how I can accurately check if grid.getCheckedRows(ind) has any rows.
Any other ideas?
Many thanks again.
coco
February 14, 2013, 8:31am
#4
Hello,
I wanted to let you know that I was able to fix the problem with this:
if (changes) {
}
Many thanks for your help!
Cheers,