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.
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.
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.
.icon-circle-triangle-n
though, as that class is used for setting the background of the element. Using only that selector would fire the click event on all such elements in the document. –
Politburo 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.
.icon-circle-triangle-n
though, as that class is used for setting the background of the element. Using only that selector would fire the click event on all such elements in the document. –
Politburo Recently I found a better solution and more efficient than trigger the click.
Just add the groupingView
element with the groupCollapse
option in the gridOptions
element.
Some like that:
// grid options
{
groupingView: {
//Collapse all
groupCollapse: true
}
}
© 2022 - 2024 — McMap. All rights reserved.