SimplePicker widget is not rendering the Nested List of JSON array.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2015 11:53 AM
Hi All,
I have a SimplePicker widget, the sample code is shown below,
My Sample JSON Nested Array response rendered by my webscript URL
I was expecting
Can someone let me know, is there anything wrong in my JSON response or the way I access
Thanks in Advance,
I have a SimplePicker widget, the sample code is shown below,
var imageLibraryPicker = { name : "alfresco/forms/controls/SimplePicker", config : { label : "Pick Image Libraries", description : "This is a simple picker publishes a request to get data to display", visibilityConfig : { initialValue : false, rules : [ { targetId : "SHOW_OTHER_FIELDS", is : [ true ] } ] }, name : "imageLibraries", noItemsMessage: "No Libraries Available!", loadDataPublishTopic : "ALF_CRUD_GET_ALL", loadDataPublishPayload : { url : "retrieve-library-list?retrieve=Image%20Library" }, itemsProperty : "imageLibrariesList.image", itemKey : "prop_cm_name", propertyToRender : "prop_cm_name", availableItemsLabel : "Available", pickedItemsLabel : "Currently Selected" }};
My Sample JSON Nested Array response rendered by my webscript URL
http://localhost:8080/alfresco/service/retrieve-library-list?retrieve=Image%20Library
is,{ "imageLibrariesList": [ { "image": [ { "prop_cm_name": "Images1" }, { "prop_cm_name": "Images2" } ] }, { "background": [ { "prop_cm_name": "Background2" }, { "prop_cm_name": "Background1" } ] }, { "stock": [ { "prop_cm_name": "Stock1" }, { "prop_cm_name": "Stock2" } ] }, { "photo": [ { "prop_cm_name": "Photo1" }, { "prop_cm_name": "Photo2" } ] }, { "graphics": [] } ]}
I was expecting
Images1
and Images2
would be rendering as per the above configuration, but it is not rendering anything and showing Could not load properties
Can someone let me know, is there anything wrong in my JSON response or the way I access
itemsProperty : "imageLibrariesList.image"
.Thanks in Advance,
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2015 05:04 AM
Here is the Simple JSON Array List(i.e Non Nested compared to my previous post),
And I am able to access this properly with the below SimplePicker,
It looks like, I am not able to access the Nested JSON Array in Simple Picker,
Please guide me if I am wrong.
Thanks in Advance,
{ "stockImagesLibraryList": [ { "prop_cm_name": "Stock2" }, { "prop_cm_name": "Stock1" } ], "backgroundImagesLibraryList": [ { "prop_cm_name": "Background2" }, { "prop_cm_name": "Background1" } ], "photoImagesLibraryList": [ { "prop_cm_name": "Photo1" }, { "prop_cm_name": "Photo2" } ], "imagesLibraryList": [ { "prop_cm_name": "Images2" }, { "prop_cm_name": "Images1" } ], "graphicsImagesLibraryList": []}
And I am able to access this properly with the below SimplePicker,
{ name : "alfresco/forms/controls/SimplePicker", config : { label : "Pick Image Libraries", description : "This is a simple picker publishes a request to get data to display", visibilityConfig : { initialValue : false, rules : [ { targetId : "SHOW_OTHER_FIELDS", is : [ true ] } ] }, name : "imageLibraries", noItemsMessage: "No Libraries Available!", loadDataPublishTopic : "ALF_CRUD_GET_ALL", loadDataPublishPayload : { url : "retrieve-library-list?retrieve=Image%20Library" }, itemsProperty : "imagesLibraryList", itemKey : "prop_cm_name", propertyToRender : "prop_cm_name", availableItemsLabel : "Available", pickedItemsLabel : "Currently Selected" }};
It looks like, I am not able to access the Nested JSON Array in Simple Picker,
Please guide me if I am wrong.
Thanks in Advance,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2015 03:12 AM
It should still be possible to access an array element if you are 100% sure that the index will never change, e.g. you could set itemsProperty to be "imageLibrariesList.0.image" (this assumes that the "image" object will always be the first element in the "imageLibrariesList" array). However, a better solution would be to use a custom service (rather than the CrudService) so that you can "normalize" your data into whatever data structure you require.
