Solved Get the database ID of an item
-
So far i managed to click an item and it prints his column and row as you can see.
But since databases uses an ID number:
-How can i print(or get) the database ID of each item?
-Or what part of the documentation I should read for that?Thanks!
-
@adrian88888888
If your "database ID of an item" is what you show in your demo column then you must get throughdata()
else there is nowhere else to store it against each line. You may hide that column in your display widget, but you must have it the model, else there will be no way to retrieve it when user clicks. -
Hi,
Do you mean the content of the first column ? The one at index 0 ?
-
@SGaist Yes!, i don't use
data()
because that column maybe will not be visible in the future.Sorry for the slow responding:
-
@adrian88888888
If your "database ID of an item" is what you show in your demo column then you must get throughdata()
else there is nowhere else to store it against each line. You may hide that column in your display widget, but you must have it the model, else there will be no way to retrieve it when user clicks. -
@JonB thanks for insisting that it was
data()
the solution, you were right, i didn't know how to correctly usedata()