Submit only checked lines

Hi,

I try to send only checked lines ids to my server when I submit a grid in a form. I can’t find a way to do that. I tried many options with serialization, but no chance…

Any help please ?

M

Did you try this:
docs.dhtmlx.com/doku.php?id=dhtm … atasending ???

Nope didn’t try, but how to use it ? How do I parse all checkd ids into the post with that ?

I suppose you use the DataProcessor!?
I mean this event will called for every modified row so you can return true or false for every row (true if row is valid).

No I don’t use dataprocessor in that specific case. I only use the grid component on a more complex page that use jquery AJAX forms.
I used to build a input field with the function below and submit form and do different actions on selected lines but it’s not compatible with the master checkbox on which I can’t trigger actions (as far as I know, would be great). That’s why I wanted to use serialization instead…

mygrid.attachEvent("onCheck", function(rId,cInd,state){
	csv = $('#checkedIds').val();
	if (state == true) {
		if ($('#checkedIds').val() == '') {
			$('#checkedIds').val(rId);
		} else {
			$('#checkedIds').val(csv + ',' + rId);
		}
	} else {
		arr = csv.split(',');
		if (jQuery.inArray(rId, arr) > -1) {
			arr.splice(arr.indexOf(rId),1);
			csv = arr.join(',');
			$('#checkedIds').val(csv);
		}
	}
});

Hi,

Sorry but I really need help on that case :slight_smile:

Manuel

In case of using the master_checkbox onCheckbox event can be used. It triggers in case of it’s checking:
docs.dhtmlx.com/doku.php?id=dhtm … oncheckbox

First of all thank you for that answer ! :slight_smile:
I was only able to test it today. It works quite good but there’s a problem remaining.
I use paging and when I click on page 3 for instance, then click on the master checkbox on that page 3, that event launches an action for the checkboxes on the first page and on the third page (in fact it launches an action for all the check boxes in the viewed pages).

How can I solve that ?

You may create your own master_checkbox that implement the logic needed to you by iterating through the rows manually.
iterating through the rendered rows:

mygrid.forEachRow(function(id){ // custom logic })

iterating through the rows loaded to the client:

mygrid.forEachRowA(function(id){ // custom logic })