0

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

Suffer
  • 11
  • 6
  • You can reload grids on topic. See https://stackoverflow.com/a/24588879/573032 – Roman C Apr 19 '19 at 22:34
  • On which topic? You mean : onSubGridRowExpanded? I'm able to get 1 subgrid but I'm not able to get 2 subgrids on the same level under a parent. Can you please detail it more @romanC – Suffer Apr 21 '19 at 16:24
  • The list of topics is published on the documentation page which is provided on the link above. – Roman C Apr 22 '19 at 09:42
  • Yeah, I saw that. But it's not a specific example. I have 2 subgrids under a grid and each subgrid has its own subGridUrl. But I'm able to populate only a single subgrid only. I'm using onSubGridRowExpanded function too. – Suffer Apr 22 '19 at 16:51
  • You should provide specific example with the code, and speak about what language is used to populate a grid. Without code and attempts to solve the problem the question has no sense. – Roman C Apr 25 '19 at 09:11
  • @RomanC I have edited my question with an example/ – Suffer Apr 25 '19 at 13:20
  • This is not an example which is expected on SO. See https://stackoverflow.com/help/mcve – Roman C Apr 25 '19 at 19:29
  • @RomanC I updated the question as, what I'm expecting from my code and what I'm getting when I use that code. – Suffer Apr 25 '19 at 21:08
  • This code is not expected to fulfil what you expected. Unfortunately there's no available solution at the moment or this problem never happens before and you is responsible to give us a solution if you ask for it. Nobody will try to get it for you without putting much effort and wait your time for the zero amount of effort from you. Rethink what you did and what you have done to better understand the problem where you stuck. – Roman C Apr 25 '19 at 21:19

0 Answers0