Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
delRowData and setSelection
30/07/2008
07:34
Avatar
zupert
Member
Members
Forum Posts: 18
Member Since:
29/07/2008
sp_UserOfflineSmall Offline

Hello Tony,

I'm trying to delete the rows selected by the user.

However, I've tryied almost all combinations ofthe following loop, without achieving that after it "getGridParam('selarrrow')" eguals zero.

How should  I do it ?

Here my code ...

Thanks in advance

	var filas = jQuery("#tabla").getGridParam('selarrrow');
	if (filas == null) {
		return false;
	} 
	for(var i=filas.length-1; i>=0; i--) {
		alert(filas+'(length='+filas.length+') current: '+filas[i]);
		jQuery("#tabla").delRowData(filas[i]);
		jQuery("#tabla").setSelection(filas[i]);
	}
	alert(jQuery("#tabla").getGridParam('selarrrow'));
30/07/2008
07:47
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Please tell me what is wrong here - you can not catch the selected rows or you can not delete them?

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

31/07/2008
01:09
Avatar
zupert
Member
Members
Forum Posts: 18
Member Since:
29/07/2008
sp_UserOfflineSmall Offline

I have a custom button, which status toggles on (un)selecting a rows. Therefor, if the user intends to delete some rows, the selection should remain empty in the end.

But the fact is that if I first delete the rows, then I can't unselect them, and they stay available in the selarrow. (I should have mention that I use multiselect)

On the other side, if I first unselect  the rows, they are correctly removed from the selarrow, which makes deletion impossible …

A workaround is to copy the array while unselecting the rows, and to loop another time for deletion…

 var filas = jQuery("#tabla").getGridParam('selarrrow');
 	if (filas == null) {
 		return false;
 	}
 	 
	var filas_delete = [];
 	var filas_select = filas;
 	
 	for(var i=filas_select.length-1; i>=0; i–) {
 		filas_delete[i] = filas_select[i];
 		alert(filas_select+'(length='+filas_select.length+') current: '+filas_select[i]+
 			'\\n my new array: '+filas_delete
 		);
 		jQuery(”#tabla”).setSelection(filas_select[i]);
 	}
 	for(var i=filas_delete.length-1; i>=0; i–) {
 		alert(filas_delete+'(length='+filas_delete.length+') current: '+filas_delete[i]);
 		jQuery(”#tabla”).delRowData(filas_delete[i]);
 	} 

31/07/2008
01:18
Avatar
zupert
Member
Members
Forum Posts: 18
Member Since:
29/07/2008
sp_UserOfflineSmall Offline

Hello Tony,

I'm so sorry : i just seen the resetSelection() function ....

Then my problem is just solved : the following code makes all the work :

	var filas = jQuery("#tabla").getGridParam('selarrrow');
	if (filas == null) {
		return false;
	}
	for(var i=filas.length-1; i>=0; i--) {
		jQuery("#tabla").delRowData(filas[i]);
	}
	jQuery("#tabla").resetSelection();

Thank you very much for this plugin and for you atention !

greetings !

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information