Hi,
I have a grid view with 3 fields, a numeric field, a date, and a text filed:
Number Date Text
-------- ------------ -----------------------------------------------
1 01-01-2013 bla bla bla
2 05-06-2013 ble ble ble :)
so, what i need is let the user to write directly in the gridview to change the values in grid or add new rows with new values.
(i already know how to add a new row and how to delete a selected row…so my need is: how to let the user edit/change values directly in the grid)
Can anyone help?
thanks.
Sure!
Just an FYI in 13.2 our next release which should come out in November the IGGridView will have a built in mechanism for editing cells.
However, b/c of the nature of how this grid was designed, you can pretty much do whatever you want. What I would do in this scenario is just simply create my own IGGridViewColumnDefinition and IGGridViewCell for editing.
http://help.infragistics.com/iOS/2013.1/?page=IGGridView_Configuring_Custom_Cell.html
http://help.infragistics.com/iOS/2013.1/?page=IGGridView_Column_Definitions.html
For your editing scenario, do you want to have your cell's always editable? Or would you prefer the user do something like DoubleTap on a cell to put the cell into edit mode?
If you let me know what you're looking for, we could put together a sample for you.
-SteveZ
Hi Steve.
you are the best :) i'm calling you boss to give you an increase in you salary!
i have a grid like this (see image). The delete button process is done! when the user want to delete a row, first he have to select the row and then push the button "Delete" (it's working thanks to you help in another post)
The Add button is what i need help for...i'm thinking:
- when the user push the button "Add", insert a new row in the end of the grid (after the last record), the grid scroll to this last new row (position in this new row) and let the user to write in that line:
- When the user tap in a Date it opens a date pickerview and the user choose the date.
- When the user tap in the text field, he can write directly in the grid
- the first column it's automatic
After that he can confirm, because the button "Add" is now "Confirm" or he can cancel the insert because the button "Delete" is now "Cancel"
want do you think? It's possible?
Thanks for you help!
I'm glad to hear that I've been helpful.
For the Add button, you could do something like this:
public void Insert(object sender, EventArgs e) { Data d = new Data (); data.Add (d); _dsh.Data = data.ToArray(); _grid.UpdateData (); _grid.ScrollToCell (new IGCellPath (data.Count - 1, 0, 0), IGGridViewScrollPosition.IGGridViewScrollPositionBottomLeft, true); }
Basically all i'm doing above is creating a new instance of my data object, and updating the data set on the DataSourceHelper. Then I tell the grid to update it's data (thats what the UpdateData call is). And finally I tell the grid to scroll to that row.
For the Date and Text columns, you want to display the data as a Label, but when the user single taps the label, you want the cell to display an editor, is that correct?
And to be clear, you don't want this behavior on all rows, just a the row that is in insert mode, right?
Just let me know, and either I or one of my colleagues will put together an example of a custom DateColumn and TextColumn that are editable for you.
Thanks Steve for your help! is now working!
I've attached a basic sample that should be enough to get you started.
It shows how you would create a custom column and cell, and add it to your dataSourceHelper.
It also has an "Add" button in the tooblar, that adds an item, to the grid, and scrolls into view.
While in that "Insert" mode, you can tap the last row, and if you do, you can put the last column into edit mode and type.
Let me know if you have any questions.
Steve,
"yes" for both of your questions