Changing location of DataGrid Template
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 44
- Joined: Thu Jul 19, 2012 1:49 pm
Changing location of DataGrid Template
Hi all
The problem I'm having is with datagrids, specifically the templates. The way it currently works if I understand correctly, the first datagrid on a stack creates a substack of datagrid templates, which the path to is stored in "Row Template" in the datagrid's custom property dgProps.
What I want to know is, how can I change this? We're developing as a team and as such are separating out each substack as a stack, so we can work on them without overwriting each others work. But we only want 1 datagrid templates substack for the entire program, and we'll be using several datagrids. Is there a way to create the datagrid template and put it into a single stack, then point the datagrid to that template?
I've tried modifying the row template, but it throws up a script error and doesn't seem to be able to find the template or script.
Am I missing something or is it simple not possible?
Many thanks
David
The problem I'm having is with datagrids, specifically the templates. The way it currently works if I understand correctly, the first datagrid on a stack creates a substack of datagrid templates, which the path to is stored in "Row Template" in the datagrid's custom property dgProps.
What I want to know is, how can I change this? We're developing as a team and as such are separating out each substack as a stack, so we can work on them without overwriting each others work. But we only want 1 datagrid templates substack for the entire program, and we'll be using several datagrids. Is there a way to create the datagrid template and put it into a single stack, then point the datagrid to that template?
I've tried modifying the row template, but it throws up a script error and doesn't seem to be able to find the template or script.
Am I missing something or is it simple not possible?
Many thanks
David
Re: Changing location of DataGrid Template
Hi David,
...
set the dgprops["row template"] of grp "your datagrid here" to the long id of grp "your new dg template here"
## ... of cd X of stack Y
...
This and more can be found in the complete "DataGrid" documentation PDF here:
http://lessons.runrev.com/m/datagrid
Best
Klaus
...
set the dgprops["row template"] of grp "your datagrid here" to the long id of grp "your new dg template here"
## ... of cd X of stack Y
...
This and more can be found in the complete "DataGrid" documentation PDF here:
http://lessons.runrev.com/m/datagrid

Best
Klaus
-
- Posts: 44
- Joined: Thu Jul 19, 2012 1:49 pm
Re: Changing location of DataGrid Template
Thanks Klaus
I've changed that property in the property inspector, under custom properties, but it hasn't worked.
Will doing it by code work?
Or set it in the message box or something?
*Edit*
I've tried doing it in the message box where I first get the row template of an existing data grid, then set the row template of the new data grid to the long id of that.
Still nothing, it throws up a script error in button data grid 1. I've followed the link that you supplied (thanks for that btw)
and it does say:
Don't Rename the "Data Grid Templates" Stack
If you rename this stack then all of your data grids with templates stored in the stack will stop working. Since the data grid can no longer locate the custom templates they will fail to draw properly.
Doesn't this mean that you can't actually change the template? Or does it mean to not change it from "Data Grid Templates xxxxx" but I could point it to another one of a similar name?
*End of Edit*
Many thanks
David
I've changed that property in the property inspector, under custom properties, but it hasn't worked.
Will doing it by code work?
Or set it in the message box or something?
*Edit*
I've tried doing it in the message box where I first get the row template of an existing data grid, then set the row template of the new data grid to the long id of that.
Still nothing, it throws up a script error in button data grid 1. I've followed the link that you supplied (thanks for that btw)
and it does say:
Don't Rename the "Data Grid Templates" Stack
If you rename this stack then all of your data grids with templates stored in the stack will stop working. Since the data grid can no longer locate the custom templates they will fail to draw properly.
Doesn't this mean that you can't actually change the template? Or does it mean to not change it from "Data Grid Templates xxxxx" but I could point it to another one of a similar name?
*End of Edit*
Many thanks
David
Re: Changing location of DataGrid Template
Hi David,
Best
Klaus
what does the error say?david.silmanBUSrUeQ wrote:...
*Edit*
I've tried doing it in the message box where I first get the row template of an existing data grid, then set the row template of the new data grid to the long id of that.
Still nothing, it throws up a script error in button data grid 1. I've followed the link that you supplied (thanks for that btw)
This only means that this is an automatism of LiveCode and if you don't know what you are doing, don't mess around with itdavid.silmanBUSrUeQ wrote:...and it does say:
Don't Rename the "Data Grid Templates" Stack
If you rename this stack then all of your data grids with templates stored in the stack will stop working. Since the data grid can no longer locate the custom templates they will fail to draw properly.
Doesn't this mean that you can't actually change the template? Or does it mean to not change it from "Data Grid Templates xxxxx" but I could point it to another one of a similar name?...

Best
Klaus
-
- Posts: 44
- Joined: Thu Jul 19, 2012 1:49 pm
Re: Changing location of DataGrid Template
Fair enough, I've managed to get it partially working, by using the message box to set the dgProps["row template"]. But it's not using the behavior script. I can see it creating the template for the first record in the grid, but it doesn't put any data into it (I'm guessing that's because it can't find the behavior script)
I got it at least find the stack by leaving in the vast amount of numbers, without those it can't even find the stack which is weird, but that's fine.
The error is:
"An error has occurred in the behavior for the row template:
Chunk: error in object expression"
Edit Script Ok
Clicking on edit script takes me to button "Data Grid" of group "Behaviors" of card "card id 1002" of stack ".........../revdatagridlibrary.rev"
Also, on the row template, I tried to set the behavior for the group to the behavior button on the card, but it keeps changing back, is there a property somewhere that's setting it back?
Thanks
David
I got it at least find the stack by leaving in the vast amount of numbers, without those it can't even find the stack which is weird, but that's fine.
The error is:
"An error has occurred in the behavior for the row template:
Chunk: error in object expression"
Edit Script Ok
Clicking on edit script takes me to button "Data Grid" of group "Behaviors" of card "card id 1002" of stack ".........../revdatagridlibrary.rev"
Also, on the row template, I tried to set the behavior for the group to the behavior button on the card, but it keeps changing back, is there a property somewhere that's setting it back?
Thanks
David
Re: Changing location of DataGrid Template
Hi David,
OK, the error just tells you that there is something (no idea what) is wrong with your behavior.
Did you set the behavior via message box?
I, personally, do not trust the inspector!
Sorry, running out of ideas, since I did not try this before myself...
Best
Klaus
OK, the error just tells you that there is something (no idea what) is wrong with your behavior.
Did you set the behavior via message box?
I, personally, do not trust the inspector!

Sorry, running out of ideas, since I did not try this before myself...
Best
Klaus
-
- Posts: 44
- Joined: Thu Jul 19, 2012 1:49 pm
Re: Changing location of DataGrid Template
No worries, thanks for the help you've been giving.
I haven't tried setting the behavior by the message box, it is the row template I need to set the behavior to isn't it?
Thanks for all the help so far
David
I haven't tried setting the behavior by the message box, it is the row template I need to set the behavior to isn't it?
Thanks for all the help so far
David
-
- Posts: 44
- Joined: Thu Jul 19, 2012 1:49 pm
Re: Changing location of DataGrid Template
Thankyou very much for your help Klaus.
That worked perfectly.
To sum up for anyone who has found this thread what you have to do:
1) Create your template in a "Data Grid Templates xxxxxx" stack
2) Create the behavior script on said template
3) Place the datagrid on your card
4) Using the message box: "set the dgProps["row template"] of group <name of data grid and path to it all the way up to stack level> to the long id of group <name of row
template and path to it all the way up to stack level>
5) Again using the message box: "set the behavior of group <name of row template and path all the way up to stack level> to the long id of <control that has the script on it
that you want to use as the behavior>"
6) Enjoy it working =D
That worked perfectly.
To sum up for anyone who has found this thread what you have to do:
1) Create your template in a "Data Grid Templates xxxxxx" stack
2) Create the behavior script on said template
3) Place the datagrid on your card
4) Using the message box: "set the dgProps["row template"] of group <name of data grid and path to it all the way up to stack level> to the long id of group <name of row
template and path to it all the way up to stack level>
5) Again using the message box: "set the behavior of group <name of row template and path all the way up to stack level> to the long id of <control that has the script on it
that you want to use as the behavior>"
6) Enjoy it working =D
Re: Changing location of DataGrid Template
Hi david,
glad you got it working!
Best
Klaus
glad you got it working!

Best
Klaus