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

Grid - toolbar.create - Calling the Read method and not calling the constructor

1 Answer 190 Views
Grid
This is a migrated thread and some comments may be shown as answers.
michel
Top achievements
Rank 1
michel asked on 31 May 2013, 01:21 PM
I've created a basic grid, but when the Create is clicked in the toolbar, it seems like the Read-method is called on the controller. Besides this, the constructor of the DossierType is not called ?
Is there any api available that I can use to direct the grid to a specific method, used during the build of the entity ?
@(Html.Kendo().Grid<DossierType>()
        .Name("dossierTypes")
        .PrefixUrlParameters(false)
        .Columns(columns =>
            {
                columns.Bound(user => user.Sample);
            }
        )
        .ToolBar(toolbar => toolbar.Create().Text("Nieuw Dossiertype"))
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .BindTo(Model.Items)
        .DataSource(config => config
            .Server()
            .Model(modelConfig => modelConfig.Id(field => field.Id))         
            .Create(create => create.Action("Create", "DossierType"))
            .Read(read => read.Action("Read", "DossierType"))
            .Update(update => update.Action("Update", "DossierType"))
            .Destroy(destroy => destroy.Action("Remove", "DossierType"))
        )
      )

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 04 Jun 2013, 07:46 AM
Hi Michel,


When server binding is used, the Grid calls the Read action in order to render the Grid in edit mode, because the data is not serialized on the client side. After that it calls the corresponding Create or Update action according to the operation. If you would like to directly trigger the Create/Update action, I would suggest you to switch to Ajax binding.

I hope that this information was helpful for you. If you are still experiencing any issues, please send me a sample runnable project, where the issue is reproducing so I could inspect it locally and assist you further.

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
michel
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or