PDA

View Full Version : [CLOSED] MVC Grid Component Column



adelaney
May 11, 2012, 6:02 PM
I have a GridPanel for which I need to display a few combos - in edit mode. It seems that Ext doesn't quite understand "displayfor" and "editorfor" concepts so my first question is how to configure the grid (in Razor) to flip/flop based on the mode (display/edit). Also, I have 4 combo columns that I want to use the same data list. I already have a WCF service which returns a select list. Is there a way to use this data as the datasource for the combo or does Ext need some other type?

Daniil
May 11, 2012, 6:28 PM
Hi,


I have a GridPanel for which I need to display a few combos - in edit mode. It seems that Ext doesn't quite understand "displayfor" and "editorfor" concepts so my first question is how to configure the grid (in Razor) to flip/flop based on the mode (display/edit).

Well, my initial thought is using two GridPanels (one - for display mode, another - for edit mode) within a container with CardLayout.

Though please clarify what will be the difference between "display" and "edit" modes? Maybe, you could avoid using two GridPanels.


Also, I have 4 combo columns that I want to use the same data list. I already have a WCF service which returns a select list. Is there a way to use this data as the datasource for the combo or does Ext need some other type?

You can define a single Store. Refer that Store to all ComboBoxes using its StoreID property.

adelaney
May 11, 2012, 6:38 PM
To clarify, when using a "read" pattern, you use the "displayfor" helper for the model, and you use an "editorfor" helper when in create or update. My point was simply that I want a grid that has no controls in "display" mode (just the selected text value) and a grid with combos in the "edit" mode. I have used other control components and they do this out of the box with MVC. I didn't know if maybe I just didn't know how to replicate this with Ext.

As for the store, I tried that but the grid complained that it "could not find" a store with that ID. I defined my store before the grid - but both are in a partial view. Would any of that matter?

Finally, as asked before, am I able to simply set the store's data to a selectList or do I have to provide data in a specific manner/format/object type? Here is an example of my store:


@(Html.X.Store().ID("EmployeeData").DataSource((ViewData("Employees"))).DataBind())

adelaney
May 11, 2012, 7:49 PM
To clarify a little more. What I am tyring to accomplish is basically this demo:
http://examples2.ext.net/#/GridPanel/ComponentColumn/Over_Editor/

Except I don't want an "over" command. Instead, I want an "edit" command which changes to a "save" or "cancel" when editing and I want 4 comboboxes which share the same datastore for the options. I see from my above example that the store is wrong, but even now when I have a store that doesn't produce an error, my grid keeps complaining that it doesn't exist which tells me that I don't have the store correct. However, after all that's done, I have to figure out my command columns and switching back and from from display to edit. :( Maybe I am too accustomed to other control sets, but I was hoping that this would be a lot easier to implement.

Vladimir
May 11, 2012, 8:00 PM
I guess you need to use RowEditor
By default, editor apperas after double click on a row
http://examples2.ext.net/#/GridPanel/Plugins/RowEditor/