0

i have jqgrid in form , i want when user click in row this row selected, but by this code just first row selected and when user click in row n row one select. i write this code

var gridItem = $('#listItem');
gridItem.jqGrid({
    url: 'jQGridHandler.ashx',
    postData: { ActionPage: 'ClearanceItems', Action: 'Fill', requestId: rowid },
    ajaxGridOptions: { cache: false },
    datatype: 'json',
    height: 200,
    colNames: ['REQUEST_ID','ITEM_NO','GOODS_DESCRIPTION','QUANTITY'],
    colModel: [
        { name: 'REQUEST_ID', width: 100, sortable: true },
        { name: 'ITEM_NO', width: 200, sortable: true },
        { name: 'GOODS_DESCRIPTION', width: 100, sortable: true },
        { name: 'QUANTITY', width: 100, sortable: true }
    ],
    gridview: true,
    rowNum: 20,
    rowList: [20, 40, 60],
    pager: '#pagerItem',
    viewrecords: true,
    sortorder: 'ASC',
    rownumbers: true,
});
gridItem.jqGrid('navGrid', '#pagerItem', { add: false, edit: false, del: true }, {}, {},
    {}, { multipleSearch: true, overlay: false, width: 460 });

thanks for help me.

Oleg
  • 217,934
  • 30
  • 386
  • 757
Pouya
  • 1,853
  • 16
  • 53
  • 78
  • Sorry, but I don't understand your requirements. The words "i want when user click in row this row selected, but by this code just first row selected and when user click in row n row one select" can be interpreted in many different ways. What is the "first row"? Is if the first visible row or the first row which the user select? If the first row on which the user click should be selected as usual what behavior should be if the user click another row? Should nothing happens? I have no idea what you mean with "user click in row n row one select". – Oleg May 27 '12 at 10:12
  • @ Oleg : thanks, I have example 3 row in GridEx, when user clicked in row3 , row 1 selected,Means on each row user clicked row 1 selected. thanks for help me. – Pouya May 28 '12 at 06:40

2 Answers2

2

If on selection of one row another row (typically the first row in the grid) will be selected then I can suppose that you have problems in filling of the data. If you would have the same id values for all rows you will have all <tr> (which represent the row) having the same ids. HTML don't permit id duplicates.

So you should change the data which generate url: 'jQGridHandler.ashx'. If the values in the 'REQUEST_ID' column are unique you can include key: true as additional property of 'REQUEST_ID' column. In the case the values from the column will be used as rowids.

Oleg
  • 217,934
  • 30
  • 386
  • 757
0

I am not sure whether you means the "multi-select", if yes, you can set the grid's option "multiselect" to true. like this:

$("#listitem").setGridParam({"multiselect":true});

or set the option on initialize:

multiselect : true