I don't really understand your problem. BUT, I think this should help:
row1, column1 = guiGridListGetSelectedItem(gridlistItems["inventory"])
if row1 and column1 then
guiGridListSetSelectedItem(gridlistItems["inventory"], row1, column1)
if row1 == -1 then guiGridListSetSelectedItem(gridlistItems["inventory"], 0, column1) end
end