jQWidgets Forums
jQuery UI Widgets › Forums › TreeGrid › General questions for TreeGrid
Tagged: jquery treegrid, jqwidgets treegrid, treegrid
This topic contains 2 replies, has 2 voices, and was last updated by michalis 10 years, 11 months ago.
-
Author
-
Hi all,
I am new to jqWidgets and i have to say you guys have done a great job! I have the following scenario and i am trying to figure out which is the best UI component i can use for the job.
Scenario:
I have a database view that returns the following columns: Year, Class, Name, Age.
Let’s assume that the view returns 5 records:
Year Class Name Age
1999 A Jon 20
1999 A Tom 23
1999 B Chris 19
1999 B Kyle 21
2000 A Johan 22I would like to create a grid that will group based on two columns – year and class.
The grid collapsed should look like this:
Year Class
>1999 A
>1999 B
>2000 AIf you expand the grid should look like this:
Year Class
-1999 A
Name Age
Jon 20
Tom 23
-1999 B
Name Age
Chris 19
Kyle 21
-2000 A
Name Age
Johan 22I had a first try using the jqxtreegrid but i am having few issues:
1) my view doesn’t have a primary/unique key. Can i get away with not define an id within the source? Can you have a composite primary key?
2) I used within the ‘hierarchy’ object the property ‘groupingDataFields’ e.g.
hierarchy:
{ groupingDataFields:
[
{
name: “Year”
},
{
name: “Class”
}
]}
The issue i have is in the table the grouping is split per level instead as a whole.
e.g. I want it to be like the following:
-1999 A
Name Age
Jon 20
Tom 23
-1999 B
Name Age
Chris 19
Kyle 21
instead is like the following:
– 1999
– A
Name Age
Jon 20
Tom 23
– B
Name Age
Chris 19
Kyle 213) Lastly i can’t find documentation for the hierarchy object. Can you please point me to it if is any?
thanks in advance,
MichalisHi michalis,
You can find documentation about the hierarchy object here: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxtreegrid/jquery-treegrid-data-sources.htm. My suggestion is to build from your data a custom nested JSON object like in this sample: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxtreegrid/javascript-tree-grid-binding-to-nested-json.htm?arctic.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
thanks for your reply.
I looked into the documentation for the hierarchy object in the link you provided. I can’t find all the available properties of the hierarchy object. The hierarchy object is used in some of the examples but is not full documentation. e.g. property ‘groupingDataFields’ is not mentioned which i found in the internet.
I just want to find out if is a property you can specify about the grouping. e.g. When i group on two fields i dont want to drill twice but once.
Also, do you have an example where you can have a table within a table with different column headers?
thanks
Michalis -
AuthorPosts
You must be logged in to reply to this topic.