Imageview ImageURL's not binding correctly using Page Container when pulling from json dataset

  1. 3 months ago

    I"m having an issue with an instagram-like multi-image component where an API request returns a json object that contains multiple image-set objects with multiple image URL's contained in an embedded object. i.e.

    {"ImageObjectName": "First Set", "media" : {"Images": ["ImageUrl.png", ImageUrl.png", "ImageUrl.png"], "otherMedia":"None" }}

    The component is constructed from an imageView within a PageContainer exactly like the ebook tutorial except for the fact the dataset is pulled via an HTTPClient and not Assets. The PageContainer successfully pulls the data as evidenced by the PageScroll dot markers but the Cell Properties (where I would select the imageURL binding) are unselectable when the settings are as follows:

    DataSet: HttpClient.EndpointRequest

    KeyPath: ImageObjectName.[0].media.images

    However, if I use settings:

    DataSet: HttpClient.EndpointRequest

    KeyPath:ImageObjectName

    I can then use the Cell Properties inspector to select media-->images-->(index value) and display individual images. The dot markers however reflect the number of ImageObjects in the entire API response not the number of imageUrls/Images in a specific ImageObject.

    Any idea how to fix this?

  2. marco

    Jun 9 Administrator User since 2016

    Hi @jsharifi do you have a project to send us for testing?
    Thanks.

  3. @marco Will email one when i get to my desk.

    Thank you so much!

  4. andrea

    Jun 20 Administrator User since 2016

    Hi @jsharifi, with the new beta you can set the KeyPath of a PageContainer programmatically.
    You can now change the KeyPath of the second PageContainer depending on the selected object in the first PageContainer with the following code in the first PageContainer's "DidSelectCell" event:

    PageContainer2.keyPath = "listings.[" + index + "].media.images";

    The cell properties of the second PageContainer was unselectable because the json contains an array of string at the "listings.[0].media.images" keypath while the inspector was expecting an array of object/dictionary, for example [ {url:"https://..."}, {url:"https://.."} ].
    The new Creo version is now able to use the data from your json, in particular if the KeyPath is "listings.[x].media.images" then you don't need to set the cell properties because it will use the only available value, the string containing the image url.

    I will send you an email with a working version of your project.

  5. Thank you @andrea so much!

  6. Hey @andrea and @marco - is there way to expose DataSet or Keypath of a custom view as a property? I"m having trouble loading nested json objects into nested custom views.

or Sign Up to reply!