awoods

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • in reply to: Selecting All Rows From Every Page #126823
    awoods
    Participant

    Sorry, I missed that local datatype detail. I understand now, thank you. What I wanted was to select all rows with the multiselect. What I did to solve this issue was to add an “All” option to the pager count dropdown, so user can show all rows in grid, then perform theĀ  select all.

    in reply to: Selecting All Rows From Every Page #126821
    awoods
    Participant

    It doesn’t seem to work, as it results in 0 rows being selected. Am I missing something? Here is an example using the one from the guriddo sitem using a button “btnSelect”:

    <!DOCTYPE html>

    <html lang=”en”>

    <head>
    <script type=”text/ecmascript” src=”http://www.guriddo.net/demo/js/jquery.min.js”></script&gt;
    <script type=”text/ecmascript” src=”http://www.guriddo.net/demo/js/trirand/i18n/grid.locale-en.js”></script&gt;
    <script type=”text/ecmascript” src=”http://www.guriddo.net/demo/js/trirand/jquery.jqGrid.min.js”></script&gt;
    <link rel=”stylesheet” type=”text/css” media=”screen” href=”http://www.guriddo.net/demo/css/jquery-ui.css&#8221; />
    <!– The link to the CSS that the grid needs –>
    <link rel=”stylesheet” type=”text/css” media=”screen” href=”http://www.guriddo.net/demo/css/trirand/ui.jqgrid.css&#8221; />
    <meta charset=”utf-8″ />
    <title>jqGrid Loading Data – Million Rows from a REST service</title>
    </head>

    <body>

    <table id=”jqGrid”></table>

    <script type=”text/javascript”>
    $(document).ready(function() {
    $(“#jqGrid”).jqGrid({
    url: ‘http://trirand.com/blog/phpjqgrid/examples/jsonp/getjsonp.php?callback=?&qwery=longorders&#8217;,
    mtype: “GET”,
    datatype: “jsonp”,
    colModel: [{
    label: ‘OrderID’,
    name: ‘OrderID’,
    key: true,
    width: 75
    },
    {
    label: ‘Customer ID’,
    name: ‘CustomerID’,
    width: 150
    },
    {
    label: ‘Order Date’,
    name: ‘OrderDate’,
    width: 150,
    formatter: ‘date’,
    formatoptions: {
    srcformat: ‘Y-m-d H:i:s’,
    newformat: ‘ShortDate’
    }
    },
    {
    label: ‘Freight’,
    name: ‘Freight’,
    width: 150
    },
    {
    label: ‘Ship Name’,
    name: ‘ShipName’,
    width: 150
    }
    ],
    viewrecords: true,
    width: 780,
    height: 250,
    multiselect: true,
    rowNum: 20,
    pager: jqGridPager
    });

    $(“#btnSelect”).click(function(){

    var indexes = $(“#jqGrid”).jqGrid(‘getGridParam’,’_index’);
    var arr=[];
    for(var key in indexes) {
    $(“#jqGrid”).jqGrid(‘setSelection’,key, true);
    arr.push(key);
    }
    $(“#jqGrid”).jqGrid(‘setGridParam’,{ ‘selarrrow’ : arr});

    var selectedIDs = $(“#jqGrid”).getGridParam(“selarrrow”);
    alert(selectedIDs.length);

    });

    });

    </script>
    <input id=”btnSelect” class=”btn btn-default” type=”button” value=”Select All Rows” />

    </body>

    </html>

Viewing 2 replies - 1 through 2 (of 2 total)

Stay connected with us in your favorite flavor!