-Note Posted May 20, 2020 Share Posted May 20, 2020 Hello I'm working on something but every time I click the selected grid list it doesn't refresh the content. Btw I'm using a table. storeList = { {food = 22, water = 15000, bp = 12}, {food = 23, water = 20000, bp = 12}, {food = 24, water = 35000, bp = 12}, } function refreshInfoListt() for k, v in ipairs(storeList) do if guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) then guiSetText(GUIEditor.label[2], "Info List: \n\Food: "..v["food"].."\nWater: "..v["water"].."\nBattle Points: "..v["bP"]) end end end addEventHandler("onClientGUIClick", GUIEditor.gridlist[1], refreshInfoListt, false) Link to comment
Moderators IIYAMA Posted May 20, 2020 Moderators Share Posted May 20, 2020 (edited) 3 hours ago, -Note said: the selected grid list it doesn't refresh the content. That condition you use inside of your loop is not very useful. All items have item text, even if they are empty. And your gridlist doesn't update, because you are not updating it with the right function. https://wiki.multitheftauto.com/wiki/GuiGridListSetItemText If you want to update just the label, that loop is not required. Make sure you save each sub table on to an item. Then you can get the selected item and get the data from it. https://wiki.multitheftauto.com/wiki/GuiGridListSetItemData https://wiki.multitheftauto.com/wiki/GuiGridListGetItemData Edited May 20, 2020 by IIYAMA Link to comment
-Note Posted May 20, 2020 Author Share Posted May 20, 2020 6 hours ago, IIYAMA said: That condition you use inside of your loop is not very useful. All items have item text, even if they are empty. And your gridlist doesn't update, because you are not updating it with the right function. https://wiki.multitheftauto.com/wiki/GuiGridListSetItemText If you want to update just the label, that loop is not required. Make sure you save each sub table on to an item. Then you can get the selected item and get the data from it. https://wiki.multitheftauto.com/wiki/GuiGridListSetItemData https://wiki.multitheftauto.com/wiki/GuiGridListGetItemData Okay thanks. I already fixed it. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now