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

  1. last year


    8 Jun 2017 User since 2017

    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


    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

    9 Jun 2017 Administrator User since 2016

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

  3. jsharifi

    9 Jun 2017 User since 2017

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

    Thank you so much!

  4. andrea

    20 Jun 2017 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. jsharifi

    20 Jun 2017 User since 2017

    Thank you @andrea so much!

  6. jsharifi

    21 Jun 2017 User since 2017

    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!