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.
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>
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With