The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Add to a DataGrid without Edit View?
Posted: 09 Aug 06 1:02 PM
|
fiogf49gjkf0d This question is actually a two parter.
I have a data grid that is populated from an edit view and it work but isn't efficient for the end users.
What I'm wanting to do is allow the users to add a new line item to the grid without using an Edit view. I want this to happen by the first column being a drop down of avalible options (also pulled from another table). Once they've chosen the initial value the other fields will auto fill based on business logic that will be scripted.
Question 1: Is this even possible? Question 2: Can a datagrid pick list be dynamically created from a table?
Thanks!
Marc |
|
|
|
Re: Add to a DataGrid without Edit View?
Posted: 09 Aug 06 1:34 PM
|
fiogf49gjkf0d Answer 1: Yes Answer 2: Yes (as long as you're on 6.2 or higher)
I've done this many times. What I do (to add a new blank row to the grid) is this:
1) Add a button to "Add" a new item somewhere 2) When the user clicks the button you add a new row to the underlying table (populating only the pertinent ID fields, create & modify fields, etc) 3) Using the ID for the new row you created, position the grid to select that row (using the grid'd selection collection) 4) I usually set a field on the new row to be something like "" or something so the user knows to edit those values. Also, if the user clicks out of that new row I can remove it (by checking to see if the primary value was still "". In your case you'll want the first item in the dropdown column to be something like "Select an item" so you'll know if nothing was set by the user if they click away from the row. Kno what I mean?
As far as having a picklist of items (populated from a table), use a Combo column in the grid. You can (at runtime) get a reference to that column and add any items you grab from a table or elsewhere to the Items collection of that column.
-Ryan |
|
|
|
Re: Add to a DataGrid without Edit View?
Posted: 09 Aug 06 5:30 PM
|
fiogf49gjkf0d I'm anal with my primary keys and I haven't tested this theory but couldn't you create the record in the updateable recordset, let the grid manipulate it, perform validation, fill in the primary key, then call .update to sync the change back to the database?
It seems very hokey but at least possible enough for me to try to revive my dead inline-only modification to the only customization where each field is present on the grid. |
|
|
|
Re: Add to a DataGrid without Edit View?
Posted: 09 Aug 06 5:51 PM
|
fiogf49gjkf0d You can set the recordset's activeconnection to nothing after the data has loaded, let the user do all the editing they want (including adds and deletes) then via an event of your choice you can reconnect the recordset and updatebatch.
Timmus |
|
|
|
Re: Add to a DataGrid without Edit View?
Posted: 11 Aug 06 10:59 AM
|
fiogf49gjkf0d This particular project has been put on hold for now. We are waiting to see what 7.0 has for us in this area before investing more time into this particular issue.
Thanks for the answers though. I've archived them away incase I need them.
Marc |
|
|
|