guiGridListClear | Multi Theft Auto: Wiki Skip to content

guiGridListClear

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function clears all the data from a grid list.

OOP Syntax Help! I don't understand this!

Syntax

bool guiGridListClear ( element gridList )
Required Arguments
  • gridList: The grid list element to be cleared

Returns

  • bool: value

Returns true if the grid list element is valid and has been cleared successfully, false otherwise.

Code Examples

shared

This creates a player list and then clears it when a button is clicked:

-- create the grid list
local playerList = guiCreateGridList(0.80, 0.40, 0.15, 0.35, true)
guiGridListAddColumn(playerList, "#", 0.15)
guiGridListAddColumn(playerList, "Player", 0.75)
-- fill the grid list with player names
for index, player in ipairs(getElementsByType("player")) do
guiGridListAddRow(playerList, index, getPlayerName(player))
end
-- create a button to clear the grid list
local clearButton = guiCreateButton(0.80, 0.30, 0.15, 0.05, "Clear list", true)
-- when the button is clicked, clear the grid list
addEventHandler("onClientGUIClick", clearButton, function()
guiGridListClear(playerList)
end)

See Also

GUI Functions