Datagrid problem [SOLVED]

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
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Datagrid problem [SOLVED]

Post by MaxV » Fri Feb 14, 2014 11:00 am

Hi,
I have a problem with my datagrid, look at the following picture (click on it to see all the picture):

Image

As you can see, the second column appear empty, but I correctly filled it. Looking in the property window I see that there are the values in the second column.
I used dgText or dgData property to fill the table, in both cases I obtain the second column empty. It' s stange since Livecode says that there are values in that column.
The datagrid in this particular case has 38'873 rows and 9 columns.
What do you think? Where is the problem?
Last edited by MaxV on Fri Feb 21, 2014 12:01 pm, edited 2 times in total.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Datagrid problem

Post by bangkok » Fri Feb 14, 2014 1:39 pm

Show us your code with DgText (the easiest way, dgData with arrays is more tricky).

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: Datagrid problem

Post by dunbarx » Fri Feb 14, 2014 2:27 pm

Hi.

What Bankok said. But real quick, what does this show in the group script:

Code: Select all

on mouseup
   get the dgText of me
   set the itemdel to tab
   answer item 2 of it
end mouseup
Click somewhere in the DG. What do you see?

Craig

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Datagrid problem

Post by MaxV » Fri Feb 14, 2014 3:54 pm

The result of:

Code: Select all

get the dgText of group "tabellona"
   set the itemdel to tab
   answer item 2 of it
is

Code: Select all

1
and it's right.

The result of

Code: Select all

put the dgText of group "tabellona"
is

Code: Select all

1	1	Come si chiamano i grandi rotoli di carta utilizzati nelle rotative da stampa?	1	Rotoloni	Bobine	Stelloni	
2	4	Come si chiama la piattaforma tripartita sulla quale poggiavano le colonne dei templi greci?	2	Stilobate	Agorà	Crepidoma	
3	2	Come si traduce in latino la parola 'uccello'?	3	Uccellus	Volatilis	Luscinia	
4	1	Come si chiamava il dio romano del mare?	4	Tritone	Nettuno	Poseidone	
5	1	In quale racconto mitologico viene ampiamente narrato l'episodio del cavallo di Troia?	5	Iliade	Eneide	Troiade	
6	5	In Italia è conosciuto col nome latinizzato di Cartesio. Ma come si chiama in realtà il famoso filosofo, scienziato e matematico francese?	6	Renè Cartes	Renè Descartes	Renè Cartesiou	
... (snip)...
38872	1	La 'Grande Muraglia' una delle sette meraviglie del mondo, passa nei pressi di quale fra queste città?	38872	Mosca	Berlino	Pechino	
38873	7	Come si chiama la disciplina che descrive e classifica le diverse varietà dei vitigni?	38873	Ampelografia	Barrique	Remuage
If you open and look carefully at the image, on the left there is the data grid and on the right the DgText. So why on Property/Content I can see the column data and on the datagrid not?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Datagrid problem

Post by bangkok » Fri Feb 14, 2014 6:07 pm

Have you checked the visible property of the second column ?

Otherwise : try to create a new DG.

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

Re: Datagrid problem

Post by Zryip TheSlug » Mon Feb 17, 2014 11:29 pm

Hi MaxV,

What are the columns name of your DataGrid and how are you populating it?



Best,
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

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Datagrid problem

Post by MaxV » Wed Feb 19, 2014 3:34 pm

Hi Zryip,
the column name is "livello" and I tried two method using dgText and dgData, you can test the script on: http://livecodeshare.runrev.com/stack/7 ... administer

It's a strange bug...
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

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

Re: Datagrid problem

Post by Zryip TheSlug » Wed Feb 19, 2014 8:56 pm

Hi MaxV,

I explored the datagrid template of your datagrid.

For columns "Livello" and "Domanda" you have a custom template. You have probably clicked on the + button at the right of the "column behavior" button in the "columns" tab of the inspector.

When a column has a custom behavior, the datagrid engine adds 2 items in the datagrid template:
- a group named with the column name. This group contains a "_columndata_" field
- a button named with the column name + "behavior"

For columns without custom behaviors, the datagrid engine uses a standard script located in the datagrid library. For columns linked to a custom behavior the datagrid is using the column button behavior located in the datagrid template.

For example for column "Livello" you should have:
- a group "livello"
- a button "livello behavior"


In your case the button "livello behavior" is missing (card id 1005 in your datagrid template substack) . That is the reason this column remains empty and do not react to double click.

Deleting the column will not solve the problem, because the inspector is not deleting the column group in the datagrid template. So when you will recreate the column with the same name, it will be linked again to the missing custom behavior.

Assuming you are not a Data Grid Helper user, for fixing the issue:
  • 1. Double-click on the datagrid group to open the inspector
    2. In the "Basic properties" tab, click on the "Row template" button
    3. In the template card, select the group, then edit it
    4. Select the "Livello" group (it has not name and should be located at the left of the "domanda" group
    5. Delete the "Livello" group
    6. Save the template card and close it
    7. The link to the column custom behavior should be removed, and your "livello" column behaving as expected.
In case a DGH user would read this message and would be confronted to a similar problem with a datagrid:
  • 1. Select the column in the DGH column builder
    2. delete it.
    3. Confirm the dialog warning about the presence of custom behavior for the column. DGH will delete the column and the corresponding controls in the datagrid template.
    4. Recreate the column

Best,
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

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Datagrid problem [SOLVED]

Post by MaxV » Fri Feb 21, 2014 12:00 pm

WOW, you are a datagrid master! You solved it!
Thank you! :D
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply