Add dynamically new item in gridView
-
Hi everyone,
I would like to know if it's possible to add a new item in a gridView when the user click on a button for example. I see nothing about that on internet.
On the screen below you can see my gridView. Currently I add items with the "listElement"
Thanks a lot
Have a good day
Simon -
Since you are using the model view frame with GridView, Model and Delegate, just add new element to the model. Grid View will be updated automatically with new delegate. No extra effort!!!!
-
Since you are using the model view frame with GridView, Model and Delegate, just add new element to the model. Grid View will be updated automatically with new delegate. No extra effort!!!!
@dheerendra said in Add dynamically new item in gridView:
Since you are using the model view frame with GridView, Model and Delegate, just add new element to the model. Grid View will be updated automatically with new delegate. No extra effort!!!!
Can you show me sample code to add in my "button.onClicked" function to do this ?
-
You can do something like follows in button.onClicked handler.
gridView.model.insert(...) or gridView.model.append(..).
See the ListModel documentation for the insert and/or append documentation. It should help you.
-
You can do something like follows in button.onClicked handler.
gridView.model.insert(...) or gridView.model.append(..).
See the ListModel documentation for the insert and/or append documentation. It should help you.
@dheerendra said in Add dynamically new item in gridView:
ListModel
Thanks a lot !
Its work perfectly :) -
Cool. Make the issue to "Solved". It helps others.