Datagrid Table - Allow editing a field only when an other field contains data
bobsneidar at iotecdigital.com
Tue Feb 12 12:22:31 EST 2019
You should really work with the dgData and the dgDataOfIndex more. you can also find a particular key more reliably by using dispatch findIndex to group "myDataGrid" with "myColumn", "myValue". This is more reliable than searching a chunk of text.
Say you have a datagrid containing hardware store items. You are wanting to find all the paints that have red in the name. You might search for the word "red" in a chunk of text, but you would also find anything made by the manufacturer "Red Head". So then you would have to conditionally branch to test whether or not what you found is really what you are looking for.
With findIndex (or findRecord) you only find the specific information you need. The downside is that you only find the first instance. What if you want ALL instances?
To get around this I wrote a function that converts a typical numbered array to a memory database, so then you can query to find ALL the matching records, then convert the cursor back to an array.
I even have a FindBar object (a group of objects really) that given the properties of the object are set, will save the contents of a datagrid, repopulate the datagrid with the matching data, and then will reset the data back to its' prior contents if you hit the "x" icon. It works really well for me. With it I can do hot type searches of all the data in all my tables.
> On Feb 11, 2019, at 09:40 , Matthias Rebbe via use-livecode <use-livecode at lists.runrev.com> wrote:
> Same here.
> mostly of the time i just use the dgText property to fill and read the table content of a datagrid
More information about the Use-livecode