We're redesigning a huge application at work and I'm tasked with figuring out whether the Infragistics grid is the appropriate tool for much of the data entry.
Our current data entry screens are nibs, and there are tons of them.
We're looking to replace all these nibs with a more generic, simple, reusable type of layout.
Per the image...
(A) The field labels would be presented in the first column in the 2-column grid. This you would just create in code, or perhaps read from an XML file.
(B) This would be an array of values pulled from Core Data (which pulled them from Sqlite). These need to go into the second column.
(C) The rows in the grid cannot be in any ol random order. For example, the user is going to be irritated if they open the app the second time and see the rows listed as ...
Current understanding / needs:
1. I think sorting will be required here in order to enforce the order of the entry fields as shown in the first column of the grid, but that will mean attaching additional data to (A) that will allow the sorting to occur, but if I did have two data items in (A), a numeric sort order value, and a corresponding label value, I don't know how I'd get the labels into the grid, while sorting with the numbers.
2. The grid only has 1 property for it's data. There isn't for example, a datasource for the labels column, and a datasource for the values column. So I'm not sure how to set up the grid for this sort of data entry.
3. The values in column 2 of the grid need to be aligned with their corresponding labels in column 1. The user will be quite confused if they see "First Name" --> 98119. I don't know how to achieve that either.
Thanks for any help.
Hi David,
You can certainly achieve all of those goals.
You do have a few options/decisions to make though.
The IGGridView uses the IGGridViewDataSource protocol to display data. This protocol is in charge of getting whatever data you want to be displayed, into the grid.
You can always implement that protocol yourself and have full control. However, we also have a helper class called the IGGridViewDataSourceHelper. This class is just an object that implements a lot of the protocol, thus getting you up and running a lot faster with less code.
The DataSourceHelper does take a single array of data to display its contents. However, in your case you want to display more data.
So now you have 2 options.
1. Create a custom object that takes your sort order index, your field name, and your field value.
2. Subclass the DSH to take an additional array of data.
if you take step 1. Things are a lot easier. You would tell the DSH to ignore the "sort" column and not display it, and to simply display your field and value columns. And thats it you're done.
If you take step 2. You can create 2 custom column definitions. (Column Definitions, provide cells and their contents tot he grid). So depending on which column you're on, you'll just access a different array off of your custom DSH to display your data.
Does that make sense?
If you like one of those approaches, and need an example. Let me know which one, and also if you're using Obj-c or C# and i'll throw a sample together for you.
-SteveZ
Thanks for the quick response.
I really like option 1.
An example in Objective-C would be awesome.