Jump to content

Grid List Help


Oussema

Recommended Posts

this part in client 

for i, v in pairs (vehs.model) do 
row = guiGridListAddRow ( GUIEditor.gridlist[1] )
guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, getVehicleNameFromModel(v), false, false )
guiGridListSetItemData ( GUIEditor.gridlist[1], row, 1, getVehicleNameFromModel(v))
for k, mddn in pairs (vehs.mod) do
guiGridListSetItemText ( GUIEditor.gridlist[1], row, 2, mddn, false, false )
end
for x, price in pairs (vehs.price) do
guiGridListSetItemText ( GUIEditor.gridlist[1], row, 3, convertNumber(price), false, false )
end
end

look at this screenshto what im geting xD the vehicels names fine but Modification and  Price is seting all same 

 

Please help 

Link to comment

Because what you're doing is, for every row loop through all the rows in the gridlist and set the table value to each of them.

what you want to do is do it all in a single loop and maybe redo your table. Maybe something like this:

local vehs = {
	{model = 411, mod = 4, price = 12000}, -- 1
	{model = 411, mod = 4, price = 12000}, -- 2 etc..
}

for i, v in pairs (vehs) do 
	local row = guiGridListAddRow ( GUIEditor.gridlist[1], getVehicleNameFromModel(v.model), v.mod, v.price)
	guiGridListSetItemData ( GUIEditor.gridlist[1], row, 1, v.model)
end

Also in 1.5.2 or so, they introduced an alternative easier way to set the text of a row for each column, the syntax is like this:

int guiGridListAddRow ( element gridList, int/string itemText1, int/string itemText2, ... )

where itemText1 is for column 1 and itemText2 for column 2 and so on.

Edited by Tails
  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...