Dynamically setting the pager for subgrids

180 Views Asked by At

I have a Grandparent, Parent, Child relationship in a struts2 jquery grid.

My goal is to be able to disable the paging/navigation bar on the Parent grid based off of the number of records returned (dynamically indicating which subgrids get pagers and which don't). The logic for determining the subgrids and retrieving each subgrid is already worked out, however I do not believe it is possible to disable/enable a pager on grids that are already created.

The wiki shows that the pager is not changeable, and I just wanted to confirm that this behavior is not supported or if I am misinterpreting the information displayed.

What are some other alternatives to accomplish my goal? I have tried jQuery("#grid_Id").jqGrid({pager: false}) as well as

jQuery("#grid_id").jqGrid({
            pgbuttons : false,
            viewrecords : false,
            pgtext : "",
            pginput : false
        });

Code for Grid Creation

<%@ page contentType="text/html; charset=UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %>

<s:url var="remoteurl" action="updateRPJson"/>
<s:url var="jiJson" action="updateJIJson"/>
<s:url var="shJson" action="updateSHJson"/>
<sjg:grid
    id="gridtable"
    caption="RP"
    dataType="json"
    href="%{remoteurl}"
    pager="true"
    gridModel="RPItems"
    rowList="10,15,20,50"
    rowNum="50"
    rownumbers="true"
    reloadTopics="reloadMyGrid"
    formIds="getRPInstance"
    onSubGridRowExpanded="getJI"
    height="600"
    width="650"
    loadonce="false"
    onCompleteTopics="disableExpandableGrid1"
    onGridCompleteTopics="gridComplete"
    onBeforeTopics="loadBefore"
    errorElementId="gridError"
>
    <sjg:grid
        id="gridtable2"
        caption="JI"
        dataType="json"
        subGridUrl="%{jiJson}"
        pager="true"
        gridModel="jiItems"
        formIds="getJI"
        reloadTopics="getJI"
        rowList="10,15,20,50"
        rowNum="20"
        rownumbers="false"
        onSubGridRowExpanded="getSH"
        autowidth="true"
        loadonce="true"
        onCompleteTopics="disableExpandableGrid2"
    >
        <sjg:grid
            id="gridtable3"
            caption="SH"
            dataType="json"
            subGridUrl="%{shJson}"
            pager="false"
            gridModel="shItems"
            formIds="getSH"
            reloadTopics="getSH"
            rowList="10,15,20,50"
            rowNum="20"
            rownumbers="false"
            autowidth="true"
            loadonce="true"
        >
            <sjg:gridColumn name="name" index="name" title="Name" key="true" hidden="true" sortable="false"/>
            <sjg:gridColumn name="health" index="healthIMG" title="" formatter="imageFormatter" width="10"/>
            <sjg:gridColumn name="label" index="label" title="Label" sortable="false"/>
            <sjg:gridColumn name="health" index="health" title="Health" hidden="true" formatter="integer" sortable="false"/>
            <sjg:gridColumn name="health" index="healthLabel" title="Status" sortable="false" formatter="healthStatusFormatter"/>
        </sjg:grid>

        <sjg:gridColumn name="name" index="name" title="Name" key="true" hidden="true" sortable="false"/>
        <sjg:gridColumn name="health" index="healthIMG" title="" formatter="imageFormatter" width="10"/>
        <sjg:gridColumn name="label" index="label" title="Label" sortable="false"/>
        <sjg:gridColumn name="health" index="health" title="Health" hidden="true" formatter="integer" sortable="false"/>
        <sjg:gridColumn name="health" index="healthLabel" title="Status" sortable="false" formatter="healthStatusFormatter"/>
        <sjg:gridColumn name="children" index="children" title="Children" sortable="false" hidden="true"/>
    </sjg:grid>
    <sjg:gridColumn name="name" key="true" index="name" title="Name" hidden="true" sortable="false"/>
    <sjg:gridColumn name="health" index="healthIMG" title="" formatter="imageFormatter" width="10"/>
    <sjg:gridColumn name="label" index="label" title="Label" sortable="false"/>
    <sjg:gridColumn name="health" index="health" title="Health" hidden="true" formatter="integer" sortable="false"/>
    <sjg:gridColumn name="health" index="healthLabel" title="Status" sortable="false" formatter="healthStatusFormatter"/>
    <sjg:gridColumn name="children" index="children" title="Children" sortable="false" hidden="true"/>
</sjg:grid>

0

There are 0 best solutions below