Page 1 of 1
Issue with DataGrid data not being up to date
Posted: Fri Jul 12, 2013 11:10 pm
by buchacho
I am having this issue come up multiple times, where a data grid is updated:
Code: Select all
set the dgData of group "GeneralTableGrid" to GeneralTableArray
And it appears to be populated, but when another script tries to get the data, it is not really there. I have to go to the properties and then cut the contents (it is there), then paste the contents back in to refresh the table. After I do this, when I run the second script, it sees the data. Am I doing something wrong or is there a bug with data grids?
Re: Issue with DataGrid data not being up to date
Posted: Sat Jul 13, 2013 12:05 am
by dunbarx
Hi.
I use dataGrids a lot. I do not understand them.
But if you do something like this:
Code: Select all
on mouseUp
put "A" & tab & "B" & return & "C" & tab & "D" into temp
set the dgtext of grp 1 to temp
end mouseUp
and then this:
Code: Select all
on mouseUp
answer the dgtext of grp 1
end mouseUp
You do not get the data back?
That said, DataGrids do have to be refreshed after certain operations. There are a few ways to do this. The refresh button in the inspector, of course, or:
dispatch "ResetList" to group "yourDataGrid"
Craig Newman
Re: Issue with DataGrid data not being up to date
Posted: Mon Jul 15, 2013 6:17 pm
by buchacho
I tried it, and it works. This issue seems to not be very consistent. I had also tried to press the "Refresh Data Grid" button in the properties inspector and it does not help. Cutting the data and re-pasting in the property inspector does help.
Essentially, I have multiple scripts that update the data grid via "set the dgData..." and then another script that uses that data, and sometimes that second script will appear to be misbehaving, but after spending a lot of time tracking the error, I find the data grid appears to be updated visually, but not "internally".
Re: Issue with DataGrid data not being up to date
Posted: Mon Jul 15, 2013 7:02 pm
by dunbarx
Hi.
But if you dispatch the command, does it alway work from that point on?
Craig Newman
Re: Issue with DataGrid data not being up to date
Posted: Mon Jul 15, 2013 9:58 pm
by buchacho
I have tried:
Code: Select all
dispatch "RefreshIndex" to group "GeneralTableGrid"
and now just tried:
Code: Select all
dispatch "ResetList" to group "GeneralTableGrid"
Both do not work. After that if I cut/paste the contents in the property manager, the subsequent script can then see the contents.
Re: Issue with DataGrid data not being up to date
Posted: Tue Jul 16, 2013 6:04 pm
by buchacho
I think I made some progress here. I found that the script I was using to populate the data grid was starting with a counter that did not begin at 1, so the empty rows were in the grid's array, but the data grid does not show those empty rows. So when I was cutting and pasting the contents in the inspector, it was wiping out the empty rows. I think this behavior is a little odd still since it can lead to confusion and what if you wanted the first few rows empty for some reason?
Re: Issue with DataGrid data not being up to date
Posted: Tue Jul 16, 2013 7:25 pm
by dunbarx
Take a brand new dataGrid named "CCC". Put this in a button script:
Code: Select all
on mouseUp
put "" & tab & "" & return & "" & tab & "" & return & "A" & tab & "B" & return & "C" & tab & "D" into temp
set the dgText of grp "CCC" to temp
end mouseUp