Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Use Nested JSON data as Section.property in JsonListModel?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #23160

    Edward

    Hey Guys,

    In my app there are various roles assigned to users, these are stored in my firebase database along with the rest of the user data (these are nested data). When constructing the listView I want to use the Boolean in their various roles to show on the model; for example

     

    {
    "firstname":"Edward",
    "surname":"Lawrence",
    "subGroup":"Reception",
    "admin":1,
    "email":"test@test.com",
    "roles":
        {"Assistant":0,"Reception":1,"Stylist":1,"Technical":0
        }
    }

     

    So my question is;

    I want my list’s section.property to be the “roles” so there will be a heading of “Assistant, Reception, Stylist, Technical”; and under these headings only those who’s Boolean evaluates to 1/true is shown

    From the above JSON When I set the property to “roles” it does not show the name “Edward” under both Reception AND Stylist!

    Is this due to it being nested?

    How could I fix this?

     

    Thanks

    #23181

    Alex
    Felgo Team

    Hi Edward,

    could you provide a minimum runnable example that shows the issue? Ideally this can also be tried right away using the Web Editor, then it would be easier to test a quick fix.

    Best,
    Alex

    #23188

    Edward
    #23229

    Edward

    Hi Alex

    Did you by chance check out the web editor link above? (I know we’ve just come out the end of Easter weekend so appreciate everyone’s had some well deserved time off)

    #23263

    Alex
    Felgo Team

    Hi Edward,

    I had a quick look, but I think this won’t work like that. Using sections will not cause a delegate to be duplicated, which would be needed in order to show up in 2 different sections of the list. Sections are essentially only grouping of the available delegates, and there is only a single delegate for each model entry. I think you’ll have to create a new model for the desired view, that containes duplicates for each section that you want a person to show up.

    Best,
    Alex

     

    #23348

    Edward

    Hi Alex;

    Thanks for the response, I’ve been playing with this and am still having issues.

    The number of different ‘lists’ needed would vary user to user, so I’ve been trying to use a Repeater to create X number of AppListViews (which works), my issue is the repeater overlays the lists on top of each other instead of them scrolling from one to the next – Further I have tried using a column within the repeater but this has the same result.

     

    How could I use a repeater to create a dynamic number of appListViews which scroll one after the other?

     

    Thanks!

    #23357

    Alex
    Felgo Team

    Hi Edward,

    a Column should work fine if you set the height of the AppListView correctly. By default it uses parent.height which will not work if the Column is the parent (it also uses parent.width, but that is fine in this case). So if you e.g. set height to dp(300), the lists should be put below each other.
    The questions is if it wouldn’t be more elegant to have all the lists combined to a single model and display that (with sections maybe) in a single list view.

    Best,
    Alex

    #23364

    Edward

    Thanks Alex;

     

    Yes over the weekend I managed to get it working, problem is I had 4 independent lists which scrolled independently (a weird user experience and not really what was looking for); i’m going to keep tweaking with the column/repeater to see how I can get a single list with multiple of the same delegate.

    Thanks

    Edward

Viewing 8 posts - 1 through 8 (of 8 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded