Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

survey: example sorted data model for ListView

[ Edited ]

Hi Folks!

 

I'm wondering if anyone was able to create a C++ data model for a Cascades ListView using the code at the bottom of this page:

Creating a GroupDataModel in both QML and C++

 

Was anyone able to get it working?

 

It seems I'm unable to get this line of code working correctly:

GroupDataModel *pModel = root->findChild<GroupDataModel*>("groupDataModel");

 

And in the qml code this line is listed as unknown property objectName: (but the qml gets still loaded)

objectName: "groupDataModel"

 

As soon as I try to add a Item to the Model the qml file fails to load.

 

In comparsion this (more simple) example works fine for me:

HelloWorldDataModel App Step By Step

 

It works without GroupDataModel placeholder in the qml file.

 

...confusing...

Developer
Posts: 136
Registered: ‎02-01-2009
My Device: Not Specified

Re: survey: example sorted data model for ListView

I had similar issues with the GroupData sample provided on that page and it has been logged in the issue tracker.

However, after working so much with lists, one would wonder on the need to having just the plaeholder in QML while everything can be done by C++ itself.

--- you can use the listView->setDataModel(model) -- method .. and it works just fine.

If you can please tell us a case otherwise, where you would need the placeholder... then would be happy to look into it.
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: survey: example sorted data model for ListView

One of the examples on that page is missing the braces.

Try:   datamodel: groupDataModel {}

 

Stuart

Developer
Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

Re: survey: example sorted data model for ListView

What do you mean? Where?

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: survey: example sorted data model for ListView

Sorry -- I misread the code Smiley Sad

 

Stuart