This is a migrated thread and some comments may be shown as answers.

Show column in edit mode (lazy load) but not in grid

1 Answer 91 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Cesare
Top achievements
Rank 1
Cesare asked on 03 Jan 2011, 03:23 AM
Hi All,

Great work on the MVC grid extensions (and I'm sure on the rest of your extensions)!

This is a common use case that I haven't found an example or documentation for.

When showing a list of entities in an editable grid, it is desirable to show some basic properties, but hide heavier properties until the user enters edit mode. For example, for the Customer entity, I want to simply show the Name, Phone, and Email columns in an ajax grid.

When the user clicks Edit on a row, I'd like to load the additional properties (Address, Description, Memo, etc.) and make them editable in the modal edit window.

The requirements are that the additional properties are NOT shown in the list view of the grid... and these values should NOT be loaded until Edit is clicked.

When setting up the grid, I imagine there needs to be an extra Ajax().BeforeEdit() call, where the controller will return the full details of the Customer entity:

.DataBinding(dataBinding => {
           dataBinding.Ajax()
                .Select("_SelectAjaxEditing", "Customer")
                .Insert("_InsertAjaxEditing", "Customer")
                .Update("_SaveAjaxEditing", "Customer")
                .Delete("_DeleteAjaxEditing", "Customer");
.BeforeEdit("_BeforeAjaxEditing", "Customer"); // Something like this
        })

Is this possible?

1 Answer, 1 is accepted

Sort by
0
rino
Top achievements
Rank 1
answered on 17 Jan 2011, 11:43 PM
Hi Cesare, use an editor template to display additional column in edit mode but I think the additional columns are loaded when the grid is loaded not when you click "Edit" as I dont see any call to server to get the columns (am using Fiddler).



.Editable(editable => editable.Mode(GridEditMode.PopUp)
        .TemplateName("YourEditorTemplate"))
Tags
General Discussions
Asked by
Cesare
Top achievements
Rank 1
Answers by
rino
Top achievements
Rank 1
Share this question
or