Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set jqGrid default to collapse

i have a working jqgrid table and I wanted the default table to collapse on load. I have checked the site's documentation but I couldn't find the option for this. The button is has a class ui-icon-circle-triangle-n.

many thanks.

like image 378
Saint Dee Avatar asked Dec 13 '11 09:12

Saint Dee


2 Answers

hiddengrid is a property of the grid that will accomplish what you want. See the last property set in the below example.

<script type="text/javascript">
     jQuery(document).ready(function () {
         var grid1 = jQuery("#list1").jqGrid({
             url: '/controller/action/',
             datatype: 'json',
             mtype: 'POST',
             colNames: ['Col1', 'Col2'],
             colModel: [
      { name: 'Col1', index: 'Col1', width: 22, align: 'left'},
      { name: 'Col2', index: 'Col2', width: 22, align: 'left'}
      ],
             sortname: 'Col1',
             sortorder: "asc",
             caption: 'Sample Grid',
             rowNum: 10,
             pager: '#,
             hiddengrid: true

     });
</script> 
like image 159
JMDenver Avatar answered Sep 30 '22 02:09

JMDenver


I once did this by calling .click() on the collapse button after loading the table. Maybe not the most robust solution, but it worked for me.

like image 31
Emil Lundberg Avatar answered Sep 30 '22 03:09

Emil Lundberg