Working with data grids (clearing a datagrid)

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
stevewhyte
Posts: 25
Joined: Mon Oct 18, 2010 6:32 pm

Working with data grids (clearing a datagrid)

Post by stevewhyte » Sat Jan 08, 2011 2:07 pm

Hi,

I hope someone can help. I have set up a data grid to store some arrays to do with graphics cards as follows:

-----------------------------------
// allow access to global arrays and variables set up in main card.
global arrayProductName
global arrayProductRam
global arrayProductClockSpeed
global arrayProductCost
global MaxVidCards

// set up local variables
local theVideoCardInfo
local CardCount

// When mouse up event is detected on this button then execute following,
on mouseUp

// zero number of video cards found
put 0 into CardCount

// clear text showing number of video cards found
put empty into field "TotalCardsFound"

// clear search type heading
put empty into field "SearchTypeHeading"

// display search type heading
put "Search: All Video Cards" into field "SearchTypeHeading"

// display all video cards
repeat with loop = 1 to MaxVidCards

// increment number of video cards displayed. This is also used to determine which line
// video card details appear within data grid.
add 1 to CardCount

// copy video card data from array to data grid
put arrayProductName[Loop] into theVideoCardInfo[CardCount]["name"]
put arrayProductRam[Loop] into theVideoCardInfo[CardCount]["memory"]
put arrayProductClockSpeed[Loop] into theVideoCardInfo[CardCount]["speed"]
put arrayProductCost[Loop] into theVideoCardInfo[CardCount]["cost"]
set the dgData of group "DataGrid 1" to theVideoCardInfo
end repeat

// display number of video cards found
put CardCount into Field "TotalCardsFound"

end mouseUp
-----------------------------------

However, I am after a command to clear the data grid once another button is selected. I've tried the put empty into data grid but that does not seem to work.

Cheers,

Steven

Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 163
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Re: Working with data grids (clearing a datagrid)

Post by Zryip TheSlug » Sat Jan 08, 2011 5:42 pm

Hi Steven,

Did you tried?:

Code: Select all

set the dgData of group "DataGrid 1" to empty

Best Regards,
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

stevewhyte
Posts: 25
Joined: Mon Oct 18, 2010 6:32 pm

Re: Working with data grids (clearing a datagrid)

Post by stevewhyte » Sun Jan 09, 2011 12:49 pm

Sorted, thanks!

Post Reply