ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: niketnaik on November 21, 2022, 10:56:49 am

Title: Get id of selected checkboxes outside of the grid
Post by: niketnaik on November 21, 2022, 10:56:49 am
I want to access selected checkboxes from outside of the grid. Check the attachment. I tried using below code
 
 
Code: [Select]
var array = []
            var checkboxes = document.querySelectorAll('input[type=checkbox]:checked');
            for (var i = 0; i < checkboxes.length; i++) {
                array.push(checkboxes[i].value);
            }

But this code skips the values of checkboxes which are on next page or in the scroll down area. I want to access all the checkboxes.
Title: Re: Get id of selected checkboxes outside of the grid
Post by: paramvir on November 21, 2022, 11:12:16 am
Please check this example: https://paramquery.com/pro/demos/checkbox_id

Code: [Select]
                        var checked = grid.Checkbox('state').getCheckedNodes().map(function(rd){
return rd.id
})
                        alert(checked);

where grid is js instance of grid.

If you don't have access to the js instance, then you can use jQuery selector to get to it,

Code: [Select]
var grid = $( selector of grid ).pqGrid( 'instance' );

More about grid variable here: https://paramquery.com/pro/tutorial#topic-special-vars
Title: Re: Get id of selected checkboxes outside of the grid
Post by: niketnaik on April 01, 2023, 11:50:10 am
Worked