DgsGridListRemoveRow

From Multi Theft Auto: Wiki
(Redirected from DgsDxGridListRemoveRow)
Jump to navigation Jump to search

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

Syntax

bool dgsGridListRemoveRow ( element gridList, int rowIndex )

Required Arguments

  • gridList: The dgs grid list you want to remove a row from
  • rowIndex: The row ID which you want to remove

Returns

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

Example

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.

DGS = exports.dgs
function deleteRow ()
        --Choose randomly which row to delete, output the
        --chosen row into the chat box, and delete the row
    	randomDeletion = math.random ( 1, 2 )   
	if randomDeletion == 1 then
		outputChatBox ( "Removing row A" )
		DGS:dgsGridListRemoveRow ( myGridList, rowA )
	elseif randomDeletion == 2 then    
		outputChatBox ( "Removing row B" )
		DGS:dgsGridListRemoveRow ( myGridList, rowB )
	end
end


function clientsideResourceStart ()
	--Create a gridlist
    	myGridList = DGS:dgsCreateGridList ( 0.30, 0.10, 0.5, 0.60, true ) 
    	--Create a column for myGridList to add rows into
        columnA = DGS:dgsGridListAddColumn ( myGridList, "columnA Title", 0.25 ) 
	--Create 2 rows for ColumnA and set the text for them
        rowA = DGS:dgsGridListAddRow ( myGridList )
	DGS:dgsGridListSetItemText ( myGridList, rowA, columnA, "Hello" )
	rowB = DGS:dgsGridListAddRow ( myGridList )
	DGS:dgsGridListSetItemText ( myGridList, rowB, columnA, "World!" )
   	--Trigger the function to delete a row 3 seconds after the script starts
        setTimer ( deleteRow, 3000, 1 )
end
addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips