0

i made one jqgrid . problem is that the first row is coming as empty by default when i am loading that grid.I don't want that empty row...and also i want to set the width of check box column as its heading "Delete" gridComplete: function() { //alert(); jQuery("#udlGrid_cb").css("width","35px"); jQuery("#udlGrid tbody tr").children().first("td").css("width","40px"); }enter image description here

jQuery("#udlGrid").jqGrid({
        caption: "Subscriber UDLs",
        height: 500,
        width: 1225,
        shrinkToFit: true,
        datatype: "local",
        rownumbers: true,
        viewrecords: true,
        //rowNum: 10,
        rowList:[50, 100, 150, 200],
        gridview: true,
        //loadtext: "Loading...",
       pager: "#pager",
        multiselect: true,
        loadonce: true,
        colNames: colHeaderArray,
        colModel: colModelArray,
        data: colDataArray,
        cellEdit: true,
        cellsubmit: 'clientArray',
        sortable: true,
         gridComplete: function() {
                      //alert();
                      jQuery("#udlGrid_cb").css("width","35px");
                      jQuery("#udlGrid tbody tr").children().first("td").css("width","40px");
                      }
    });
    jQuery("#udlGrid").jqGrid("setLabel", "cb", "Delete");
    jQuery('#udlGrid').jqGrid('setGridParam', {data: colDataArray}).trigger("reloadGrid",[{current: true}]);...this delete and below checkboxes are coming by default
  • Could you include `colDataArray` data and `colModelArray`? Why you use `setGridParam` with `{data: colDataArray}` and then trigger `reloadGrid`? You used `data: colDataArray` at the creating of the grid. So the data have already the same data. – Oleg Apr 10 '14 at 10:40

3 Answers3

1

To set the width of multiselect column you should use multiselectWidth column. It's default value is 20. To have 40px you can use multiselectWidth: 40 and remove your current gridComplete. By the way I don't recommend to use gridComplete at all. I recommend you to read the answer for more details.

To help you with first empty row you should include the data which you use to fill the grid and you should include more full code which shows how you create jqGrid (with which options).

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • thanks for multiSelectWidth.......i am reading one excel sheet and i am populating the grid with excel sheet values.... – user3381985 Apr 10 '14 at 11:08
  • @user3381985: You are welcome! Do you have found the reason of the first empty row? Is the problem are solved now? – Oleg Apr 10 '14 at 11:52
  • no i did not found... i searched but did not get anything which works for me by far... – user3381985 Apr 10 '14 at 11:54
  • @user3381985: Could you append the text of your question with values of `colDataArray` and `colModelArray`? In the case one will be able to reproduce the problem and so to fix it. – Oleg Apr 10 '14 at 12:03
0

share your basic code , which you used to create the jqgrid, and you can set the width as follows :

{ name: 'Criteria', index: 'Criteria', width: 40, align: 'Center'},
0

Use Css to make the first row of jqgrid invisible

   #body .jqgfirstrow{display:none;}//inspect element for the class

Set the width during initialization

   { name: 'Delete', index: 'Delete', width: 50px, align: 'Center'},
neel shah
  • 2,231
  • 15
  • 19