I’m using Dojo 1.7 and I have a problem with the dojox/grid/DataGrid and dojox/data/CsvStore. I want to create a dojo DataGrid that responds to text input from the user. The user would type in something that is in CSV format into the text area and the CsvStore would read that data and feed it to the DataGrid but I have a few problems and questions.
-
CsvStoredoesn’t always load on time. That is, the_loadFinishedproperty isn’t always true when it is time to feed it to theDataGrid. Do I have to useDeferredor something? This object has no event properties as I had hoped. -
It seems that
DataGridmust absolutely have to have thestructureproperty declared. I’m not sure if this is true can someone please tell me? Is there a way to bypass this? Because if not this leads to my third problem. -
If I need to declare my
DataGridstructure/layout, I need to know the fieldnames which I need to extract fromCsvStoresince I have no idea what my data looks like. I’m not sure how to do this because I can’t call the internal_attributesproperty that holds the field names. It seems to me that my best bet is using thegetAttributes(item)method but I don’t know whatitemis and according to the documentation, this valuable is required.
Thanks for all your time.
So for anyone interested, this is how I fixed the issue.
Apparently
CsvStoreand all of the Dojo stores don’t use their primary method_processDataunless called by some other widget such as the Grid so it belongs on the same thread.DataGridmust have a structure which is bizarre. I think it should be optionalThere was no way to retrieve those fieldnames. I had to use string manipulation (sad-face). Maybe I’m wrong, hopefully someone can tell me how.