PDA

View Full Version : From a button in a canvas section, how can I activate a grid in a grid section?



Question
2012-01-03, 06:33
From a button in a canvas section, how can I activate a grid in a grid section?

lianjasupport
2012-01-03, 06:33
This functionality has been added into beta5 Refresh 2.

Note also that you can use the addItems() method to populate a grid from an array. (See below). Also notice how in Lianja you can create arrays in VFP scripting using the { .... } constructs (same as PHP and JavaScript).

////////////////////////////////////////////////////////////////
// Event delegate for 'click' event -- populates the grid using SQL
proc page1_section2_field1_click()
mygrid = Lianja.findElementByID("mygrid").grid
mygrid.clear
mygrid.addItems("select * from southwind!example")
endproc

////////////////////////////////////////////////////////////////
// Event delegate for 'click' event -- clears the grid
proc page1_section2_field2_click()
mygrid = Lianja.findElementByID("mygrid").grid
mygrid.clear
endproc

////////////////////////////////////////////////////////////////
// Event delegate for 'click' event -- populates a grid from an array
proc page1_section2_field3_click()
mygrid = Lianja.findElementByID("mygrid").grid
mygrid.clear
myarray = { {"one", "two"}, {"Three", "Four"} }
myheader = { "Name", "Value" }
mywidths = { 100, 200 }
mygrid.addItems(myarray, myheader, mywidths)
endproc