DataGrid form versus table
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 339
- Joined: Wed Jul 11, 2012 9:24 pm
DataGrid form versus table
I have successfully created Datagrid tables using an outside database. It uses tab-delimited information (actually, I modify the information once it reaches LiveCode to make it tab-delimited).
Now, I am trying to format them using Datagrid forms. And it doesn't work. I don't know why... Once it works in a table, I switch it to forms, then set up the row template and row behavior. That's all I do...
Then, to make me crazy, once it fails in Datagrid forms, it no longer works when I switch it back to a table - so I have to start all over again.
Here is the code that works in table, but not in forms:
global cx
put "http://mywebsite/forum.cfm?cx=" & cx & "" into turl
put url(turl) into theData_forum
replace "xyz" with return in theData_forum
replace "usetab" with tab in theData_forum
--add data
put false into firstLineAreNames
set the dgText[firstLineAreNames] of group "DataGrid top" to theData_forum
put the width of this stack into tStackWidth
put the dgDataOfLine[1] of group "DataGrid top" into theDataZ
if theDataZ["topic"] is empty then
put 1 into theLine
send "DeleteLines theLine" to grp "DataGrid top"
end if
What am I doing wrong?
Now, I am trying to format them using Datagrid forms. And it doesn't work. I don't know why... Once it works in a table, I switch it to forms, then set up the row template and row behavior. That's all I do...
Then, to make me crazy, once it fails in Datagrid forms, it no longer works when I switch it back to a table - so I have to start all over again.
Here is the code that works in table, but not in forms:
global cx
put "http://mywebsite/forum.cfm?cx=" & cx & "" into turl
put url(turl) into theData_forum
replace "xyz" with return in theData_forum
replace "usetab" with tab in theData_forum
--add data
put false into firstLineAreNames
set the dgText[firstLineAreNames] of group "DataGrid top" to theData_forum
put the width of this stack into tStackWidth
put the dgDataOfLine[1] of group "DataGrid top" into theDataZ
if theDataZ["topic"] is empty then
put 1 into theLine
send "DeleteLines theLine" to grp "DataGrid top"
end if
What am I doing wrong?
Re: DataGrid form versus table
This is a mistake : with those quotes, LiveCode will send "DeleteLines theLine", instead of DeletesLines 1 [the content of the variable theLine]cusingerBUSCw5N wrote: send "DeleteLines theLine" to grp "DataGrid top"
Try instead :
Code: Select all
send "DeleteLines "&&theLine to grp "DataGrid top"
Code: Select all
dispatch DeleteLines to grp ""DataGrid top"" with theLine
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: DataGrid form versus table
Actually, I do that sort of thing a lot, LiveCode should evaluate the parameter correctly. But I'm not sure about this part:bangkok wrote:This is a mistake : with those quotes, LiveCode will send "DeleteLines theLine", instead of DeletesLines 1 [the content of the variable theLine]cusingerBUSCw5N wrote: send "DeleteLines theLine" to grp "DataGrid top"
Won't that produce an invalid key for dgText? It evaluates to dgText[false].put false into firstLineAreNames
set the dgText[firstLineAreNames] of group "DataGrid top" to theData_forum
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: DataGrid form versus table
You can set the dgTEXT of grp "datagrid" as often as you want,
but this will only work (= visible resutls) with a datagrid of type TABLE!
If you have a FORM datagrid, you need to supply an array:
set the dgDATA of grp "datagrid" to tArray
And you need to script a custom behavior so the datagrid knows what data of the array have to go where.
This is a complex best and I highly recommend to work through the examples in the datagrid documentation PDF.
Get it here: http://lessons.runrev.com/m/datagrid
At least this is nothing that can be handled here in the forum in a couple of sentences
@Jacqueline
dgText[false] = dgtext = Correct syntax, no error or something.
Best
Klaus
but this will only work (= visible resutls) with a datagrid of type TABLE!
If you have a FORM datagrid, you need to supply an array:
set the dgDATA of grp "datagrid" to tArray
And you need to script a custom behavior so the datagrid knows what data of the array have to go where.
This is a complex best and I highly recommend to work through the examples in the datagrid documentation PDF.
Get it here: http://lessons.runrev.com/m/datagrid
At least this is nothing that can be handled here in the forum in a couple of sentences
@Jacqueline
dgText[false] = dgtext = Correct syntax, no error or something.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: DataGrid form versus table
The dgText has a key named "false"?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: DataGrid form versus table
Hi Jaqueline,
From the DataGrid docs:
...by passing in true for pFirstLineContainsHeaders.
If true then the data grid will extract the first line of pText and use the values for the internal key/column names.
The default value for pFirstLineContainsHeaders is false.
...
Best
Klaus
yep, that is the default, so this is correct syntax, although unneccessary, just leave it empty in that casejacque wrote:The dgText has a key named "false"?
From the DataGrid docs:
...by passing in true for pFirstLineContainsHeaders.
If true then the data grid will extract the first line of pText and use the values for the internal key/column names.
The default value for pFirstLineContainsHeaders is false.
...
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: DataGrid form versus table
Ok, I'll go take a look. Thanks Klaus.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com