guiGridListRemoveRow | Multi Theft Auto: Wiki Skip to content

guiGridListRemoveRow

Client-side
Server-side
Shared

Pair: guiGridListAddRow

This allows you to delete rows that exist in grid lists.

OOP Syntax Help! I don't understand this!

Syntax

bool guiGridListRemoveRow ( ​gui-gridlist gridList, ​int rowIndex )
Required arguments
  • gridList: The grid list you want to remove a row from.
  • rowIndex: The row ID which you want to remove. Indexes start at 0.

Returns

Returns true if the grid list row was successfully removed, false otherwise.

  • bool: result

Code Examples

client

In this example, when the script starts, a grid list with 1 column and 2 rows, which have text assigned to them. After 3 seconds, one row is randomly deleted.

local myGridList
function deleteRow()
-- Choose randomly which row to delete, output the
-- chosen row into the chat box, and delete the row
local randomDeletion = math.random(0, 1)
if randomDeletion == 0 then
outputChatBox("Removing row A")
elseif randomDeletion == 1 then
outputChatBox("Removing row B")
end
guiGridListRemoveRow(myGridList, randomDeletion)
end
function clientsideResourceStart()
-- Create a gridlist
myGridList = guiCreateGridList(0.30, 0.10, 0.5, 0.60, true)
-- Create a column for myGridList to add rows into
local columnA = guiGridListAddColumn(myGridList, "columnA Title", 0.25)
-- Create 2 rows for ColumnA and set the text for them
local rowA = guiGridListAddRow(myGridList)
guiGridListSetItemText(myGridList, rowA, columnA, "Hello", false, false)
local rowB = guiGridListAddRow(myGridList)
guiGridListSetItemText(myGridList, rowB, columnA, "World!", false, false)
-- Trigger the function to delete a row 3 seconds after the script starts
setTimer(deleteRow, 3000, 1)
end
addEventHandler("onClientResourceStart", resourceRoot, clientsideResourceStart)

See Also

GUI Functions