Question
Anthem Inc.
US
Last activity: 6 Jan 2016 10:37 EST
Is there any option to display the tree grid expanded by default in editable mode?
I have a scenario, where I call a service and my service returns the response in a tree-grid structure (JSON object). Once the response is received then I need to display it in the UI
with all the details expanded by default.
If this cannot be done then is there any easy way in converting the tree-grid page structure to a regular page-list so that I can display them in a normal repeat grid?
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Anthem Inc.
US
Hi,
This option is for read-only tree-grids (when we save the section then it will throw an error saying that always expand the root is read-only mode). In my scenario, the user has to update the fields in the grid.
Updated: 28 Dec 2015 11:27 EST
Boardwalk Pipelines
US
Pegasystems Inc.
IN
You can simply set pyExpanded property to true anywhere in pre-processing and that should do the work for you. Let us know if this helps.
Anthem Inc.
US
Hi Pankaj,
In the pre-activity of the flow action, I am calling the service to get response which will be in Parent-Child format. To which I need to set the pyExpanded to true?
Thanks,
Revanth
Pegasystems Inc.
IN
Yes, what ever parent node you want to be expanded by default, set this property to true.
In example below, if you want Node 1 to be expanded by default,set pyExpanded on that page to true. Let me know if this helps
-- > Node 1
--> Child Node 1
--> Child Node 2
--> Node 2
--> Child Node 3
--> Child Node 4
Anthem Inc.
US
Thanks for the detailed explanation.
In my scenario, I don't know the depth of the child nodes -
one service response could be:
parent
-->Child
-->Child
--> Child
--> Child
--> Child
-->Child
in the above response there are three child nodes.....in another response there could be 5 sub child nodes. If I know depth we can loop and set the pyExpanded to true in the pre-activity.
Pegasystems Inc.
IN
So if I am understanding correctly, you want to expand all the inner nodes also ?
You might want to find a common hook to set this property to true, may be pyDefault data transform for node class ?
Else looping seems to be the only option, you need to loop and set pyExpanded to true to all possible parent nodes.
Also I am confused with "If I know depth we can loop".
We can just loop using for each embedded page and use a recursive data transform call to set property value.
Let me know if I am missing something here.
Anthem Inc.
US
ok...my page structure is
ServicePage.ResponsePage.Children (children class) this children will have children -- Level 1
---->Children
----> Children ---> level 2
--> Children
-->Children
---->Children ---Level 3
----> Children
---> Children -- Level 4
---> Children
---> Children
This structure will be formed automatically from CONNECT-REST so I cant call Data Transform to set pyExpanded to True
When you are looping through activity:
the first step is --> For Each Embeded Page and step page is --> ServicePage.ResponsePage.Children
and in 1.1 For Each EmbdedPage and StepPage is --> .Children like wise we need to write 1.2.1 and Proprietary information hidden steps to loop children
some of the responses might have level 5, 6 or 7 and this template might change in future as well.
Please let me know if we can achieve this recursively in other way.
ok...my page structure is
ServicePage.ResponsePage.Children (children class) this children will have children -- Level 1
---->Children
----> Children ---> level 2
--> Children
-->Children
---->Children ---Level 3
----> Children
---> Children -- Level 4
---> Children
---> Children
This structure will be formed automatically from CONNECT-REST so I cant call Data Transform to set pyExpanded to True
When you are looping through activity:
the first step is --> For Each Embeded Page and step page is --> ServicePage.ResponsePage.Children
and in 1.1 For Each EmbdedPage and StepPage is --> .Children like wise we need to write 1.2.1 and Proprietary information hidden steps to loop children
some of the responses might have level 5, 6 or 7 and this template might change in future as well.
Please let me know if we can achieve this recursively in other way.
Pegasystems Inc.
IN
So I am assuming each Children is same property in all levels from the way you described.
You can simply call a data transform on the main page and that data transform can call itself for all inner children. See below for example and let me know if this helps.
In below case WorkPPage can be your ServicePage.ResponsePage and Data transform need to loop over .Children instead of .pxResults and it should work
Anthem Inc.
US
It works, thanks for the help Pankaj. But due to the requirement specifications I am not able to use tree grid in my scenario. So, I am converting all the tree grid records into a single page list structure and display them in a row repeat. While converting to single pagelist, I am using a spaces property to indicate the depth of the each children. While rendering the page list in UI, based on the value of spaces property I am adding 's in a cell to get the extra space to indicate that as children. But, at run time the repeat grid does not show up the space. I am using 100% fill as layout width.
Could you please let me know when exactly the space will be rendered in UI at run time?
thanks,
Revanth
Anthem Inc.
US
  got rendered in the above message
Pegasystems Inc.
IN
Glad that worked
I am sure there are ways to workaround and add space but I would suggest using tree grid only according to your structure rather than using grid and adding spaces as work around. Is there any particular behavior you want which is only available using repeat grid ?
Just for my understanding would like to know why you are not using tree grid for a tree structure ?
Anthem Inc.
US
The reason why we were not able to use the tree grid structure because:
the response from the service will be like this:
Document Name
Description
Questions (parent-child)
Disclaimer
each line will come as a children to the previous line. i.e. responsepage.Children(1) will contain document name, responsepage.Children(1).Children(1) will have description and responsepage.Children(1).Children(2) contains questions (parent-child manner).
There are possibilities that the another description/label might be added anywhere in the document. So, I cannot alone break the questions from the response as we will not be sure in which node the questions will be there. IF we convert the tree-grid to single page list then even if there is any addition/deletion on the format will be handled dynamically.
Anthem Inc.
US
Hi Pankaj,
I was able to get level param for each record. I tried using & nbsp; in control and keeping that control in repeat grid section. But, all the rows are getting aligned to last level. Could you please let me know what type of layout format should be used (pxFixed, 100% fill etc..)?
control I have written is:
<script>
<pega:when level=="1">
</pega:when>
level==2
....
....