I took your code under a quick scope and made the other parts with some rubbish code, but it works for me this way;
vehicleTypeGrid = guiCreateGridList ( 400, 200, 150, 300, false );
vehicleGrid = guiCreateGridList ( 600, 200, 250, 300, false );
column = guiGridListAddColumn( vehicleGrid, "Vehicle", 0.85 )
column = guiGridListAddColumn( vehicleTypeGrid, "Type", 0.85 )
row = guiGridListAddRow ( vehicleTypeGrid )
guiGridListSetItemText ( vehicleTypeGrid, row, 1, "Cars", false, false )
addEventHandler ( "onClientGUIClick", root,
function()
if ( source == vehicleTypeGrid ) then
local row, col = guiGridListGetSelectedItem(source)
if row and col and row ~= -1 and col ~= -1 then
local category = guiGridListGetItemText(source, row, 1)
guiGridListClear ( vehicleGrid )
if ( vehicleCategory [ category ] ) then
for _, veh in ipairs ( vehicleCategory [ category ] ) do
local row = guiGridListAddRow ( vehicleGrid )
guiGridListSetItemText ( vehicleGrid, row, 1, veh [ 2 ], false, false )
guiGridListSetItemData ( vehicleGrid, row, 1, veh [ 1 ] )
end
end
end
end
end
)