MVC 6 Custom Toolbar

6 posts, 0 answers
  1. Arie
    Arie avatar
    20 posts
    Member since:
    Jun 2014

    Posted 01 Oct 2015 Link to this post

    We are currently updating an application to use MVC 6 with the current set of beta release from Telerik with the MVC wrappers.We are running into one sticking point that the demos do not address and I cannot find anywhere in the docs where it does either.

    On out pages we have multiple grids with custom toolbars deployed using the common syntax

           .ToolBar(toolbar =>
            {
                toolbar.Template(
                    @<text>
                       //Bunch of code remove for brevity
                    </text>);
            })

     

    However, this throws an error and upon further inspection the toolbar.Template method doesn't exist. We did find ClientTemplate but we cannot seem to get this to work. How are we supposed to implement a custom toolbar now? We saw that there may be a way in which we could specify a ViewComponent but it was not very clear.

    If you could provide us an example this would go a long way to us getting this out the door.. So far all of the other controls seem to be working no problem.

     

    Thanks,
    AJ

     


     
     
  2. Rosen
    Admin
    Rosen avatar
    3241 posts

    Posted 05 Oct 2015 Link to this post

    Hello Arie,

    Indeed, since the Grid widget does not support server-rendering, server templates were removed. You should use the client template instead.

    Regards,
    Rosen
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Arie
    Arie avatar
    20 posts
    Member since:
    Jun 2014

    Posted 05 Oct 2015 in reply to Rosen Link to this post

    Thank you for the response but could we get an example of "how" these custom client side templates are supposed to work. Since we cannot set a template id like we do with some of the detail templates we are wondering the best path of least resistance forward.

     One of my people attempted to use a client side template as we have with the toolbar.Template syntax and it just blows up. Is there a way in which we can use the Telerik templating scheme like we do for the grid item details.

     Or can we use a ViewComponent for this possibly?

     

    Thanks for your insight,
    AJ

  4. Rosen
    Admin
    Rosen avatar
    3241 posts

    Posted 06 Oct 2015 Link to this post

    Hello Arie,

    Indeed, when having more complex toolbar template a ClientToolbarId option will be very useful and we will consider adding such option. Currently, it is still possible to load an external template. Please take at the attached View, which demonstrates how to implement it.

    Regards,
    Rosen
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Marcel Härry
    Marcel Härry avatar
    29 posts
    Member since:
    Jul 2009

    Posted 06 Feb Link to this post

    How can I embed the standard grid buttons
    Create() and Save()
    this template? 

  6. Rosen
    Admin
    Rosen avatar
    3241 posts

    Posted 06 Feb Link to this post

    Hello Marcel Härry,

    I'm afraid that it is not possible to use the Create or Save command builder configuration when using toolbar template. You should either use the builders as shown in this demo, or use custom buttons inside the toolbar template which to use the Grid API (createRow and saveChanges) to trigger the appropriate actions.

    Regards,
    Rosen
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top