joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
74 stars 55 forks source link

Custom Style + Global search and Page size #42

Closed Kiba33 closed 8 years ago

Kiba33 commented 8 years ago

Hey,

first of all: great grid and it's very useful.

My problem: if i use a custom style for the Grid, then the Search and the Page sizing (that comes from the toolbar) are not working anymore. I use for the search and page sizing the AdditionalQueryOptions. The javascript is also present on the side.

I add the style with DefaultRenderingEngineName from the GridDefaults and in the Grid with .AddRenderingEngine

  public static class MVCGridConfig
    {
        private static GridDefaults gridDefaults = new GridDefaults()
        {
            DefaultRenderingEngineName = "CustomHtmlRenderingEngine"
        };

        public static void RegisterGrids()
        {
            MVCGridDefinitionTable.Add("UserGrid", new MVCGridBuilder<UserViewModel>(gridDefaults)
                .AddRenderingEngine("CustomHtmlRenderingEngine", (typeof(CustomHtmlRenderingEngine)))
                .WithAuthorizationType(AuthorizationType.Authorized)
                .AddColumns(cols =>

If i remove the custom style than everything works fine.

Is there a solution for it. Or am i missing something.

joeharrison714 commented 8 years ago

Kiba, Thanks for letting me know. I had a missing line in the example CustomHtmlRenderingEngine.cs

The last line of the render method should be: outputStream.Write(model.ClientDataTransferHtmlBlock);

This outputs some hidden json data that is used by the client side script.

Hope this helps. -Joe