Suffer
Suffer

Reputation: 11

How to create a Grid with a single Parent grid and 2 subgrid on the same level using Struts2 Jquery Grid (sjg:grid) plugin

I'm trying to get my grid structure in 1 parent grid and 2 children (both children should be in the same label) grid under that parent.

I found 1 solution - but this is Grandparent - Parent-Child relation. (1 grid under other ) https://searchcode.com/codesearch/view/4417536/

But I need 1 parent - 2 children (2 grid on the same level under other)

I found the solution using other plugins but I did not find any solution using Grid in Struts2 using the struts2-jquery-grid plugin. http://www.trirand.net/examples/grid/hierarchy/several_subgrids/default.aspx

I'm trying to do it like this but I'm able to see only 1 child subgrid under the parent grid. Actually, I need to display 2 subgrids on the same level under 1 parent. This is my problem.

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

<s:url id="ordersurl" action="json-orders" />
<s:url id="orderdetailsurl" action="json-orderdetails" />
<s:url id="customersurl" action="json-table" escapeAmp="false" />

<h2>Grid with 2 children Subgrid on the same Level</h2>

<sjg:grid id="customerstable" caption="Customers" dataType="json"
    href="%{customersurl}" pager="true" gridModel="gridModel"
    rowList="10,15,20" rowNum="15" viewrecords="true" altRows="true">


    <sjg:grid id="orderstable" caption="Orders with Orderdetails Subgrid"
        dataType="json" subGridUrl="%{ordersurl}" pager="true"
        navigator="true" navigatorEdit="false" navigatorAdd="false"
        navigatorView="true" navigatorDelete="false" gridModel="gridModel"
        rowList="10,15,20" rowNum="15" viewrecords="true">
        <sjg:gridColumn name="ordernumber" index="ordernumber" key="true"
            title="Order" formatter="integer" sortable="true" search="true"
            searchoptions="{sopt:['eq','ne','lt','gt']}" />
        <sjg:gridColumn name="orderdate" index="orderdate" title="Order Date"
            formatter="date" sortable="true" />
    </sjg:grid>


    <sjg:grid id="orderssubgridtable" subGridUrl="%{orderdetailsurl}"
        gridModel="gridModel" rowNum="-1" footerrow="true"
        userDataOnFooter="true">
        <sjg:gridColumn name="productcode" key="true" title="Product Code"
            width="300" hidden="true" />
    </sjg:grid>


    <sjg:gridColumn name="customernumber" index="customernumber" key="true"
        title="ID" width="50" formatter="integer" />
    <sjg:gridColumn name="customername" index="customername"
        title="Company" width="300" />
</sjg:grid>

i'm expecting grid looks like this

Upvotes: 0

Views: 243

Answers (0)

Related Questions