Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I set the following three options within the <code>jqGrid</code> call with these functions:</p> <pre><code>onSelectRow: HandleSelectRow, onSelectAll: HandleSelectAll, gridComplete: HandleSelectedIds, </code></pre> <p>My functions look like these:</p> <pre><code>function HandleSelectRow(id, selected) { // Did they select a row or de-select a row? if (selected == true) { var currIndex = SELECTEDIDS.length; //selected_jq_ids_array[currIndex] = id; SELECTEDIDS.push(id); //SELECTEDIDS is a global variable I defined. } else { // Filter through the array returning every value EXCEPT the id I want removed. SELECTEDIDS = $.grep(SELECTEDIDS, function(value) { return value != id; }); } } </code></pre> <p>The next one:</p> <pre><code>function HandleSelectAll(id, selected) { // Did they select or deselect? if (selected == true) { for (single_id in id) { // If the value is NOT in the array, then add it to the array. if ($.inArray(id[single_id], SELECTEDIDS) == -1) { SELECTEDIDS.push(id[single_id]); } } } else { for (single_id in id) { // If the value is in the array, then take it out. if ($.inArray(id[single_id], SELECTEDIDS) != -1) { SELECTEDIDS = $.grep(SELECTEDIDS, function (value) { return value != id[single_id]; }); } } } } </code></pre> <p>And the last one:</p> <pre><code>function HandleSelectedIds() { if (SELECTEDIDS != null) { currentGridIds = new Array(); currentGridIds = $("#lookupControl").getDataIDs(); //Make Selection for (var e = 0; e &lt; currentGridIds.length; e++) for (var i = 0; i &lt; SELECTEDIDS.length; i++) if (SELECTEDIDS[i] == currentGridIds[e]) jQuery("#lookupControl").setSelection(SELECTEDIDS[i], false); // TODO: Some logic on if all the rows on the current page are selected, then make sure to check the "Select All" checkbox. //var selectedIds = $("#lookupControl").getGridParam('selarrrow'); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload