jQWidgets Forums
Forum Replies Created
-
Author
-
August 21, 2013 at 8:01 am in reply to: Json data with sub-objects Json data with sub-objects #27261
I used getRecordsHierarchy for mapping convenience. But as you pointed out, I could either use a DTO to match tree field naming, or either use a javascript method to convert my list.
It’s just that I prefer to use a direct functionality included in the UI component. Configuration over manipulation before calling the component.
I have tested many UI component in several libraries and one of the main problem is how to bind datasource to the component’s source.
Many of them require specific format and you must convert your source to use them.
I really like dataTables jquery plugin as it is highly configurable. I could just create my table and apply their component in the worst scenarii.Back to the subject, getRecordsHierarchy returns hierarchy but can also transform the datasource with its mapping. This functionality is exactly what I was trying to explain. And even if I do have an initial hierarchy, it might not be in the right format.
I am quoting documentation: “The third parameter which is optional specifies the name of the ‘children’ collection. The last parameter specifies the mapping between the data Source fields and custom data fields.”
First phrase let me think that you can already have a hierarchy as a source but the second one doesn’t say precisely if we can also specify a mapping for children collection. Well, in fact, what’s purpose is the 3rd parameter ? I guess most developpers would have thought as I did, use it to map a children collection. But then, why could we map the main object and not children items?
I think this data-adapter is a great component, but unless I haven’t understand everything about it, it still lacks some details on how to properly use children items, assuming children will probably not be in the proper format.Maybe, I am just wrong on this subject ?
August 20, 2013 at 6:19 pm in reply to: Json data with sub-objects Json data with sub-objects #27221Hello Peter,
Thank you for your answer. I haven’t read carefully and it worked fine with your example.
I have also experimented with my own DTO in the proper format. It was a success, obviously.My last unsolved problem is the use of ‘items’ in getRecordsHierarchy. The last parameter specifies the mapping between the Data Source fields and custom data fields. It applies to the main object but there is no mapping for item object ? (which may be identical or not to the main object). Maybe, items weren’t destined to be used as children in a tree?
All in all, I’m satisfied with the 2 first solutions, especially the second one, as it costs too much to send all parents of each element.
-
AuthorPosts