GridToolBarCommandFactory Grid Name

1 Answer 8 Views
Grid
Dale
Top achievements
Rank 1
Iron
Dale asked on 30 May 2025, 04:48 AM

Prior to the most recent version we could use reflection to get the grid name in this method.

We have changed it to pass the grid name, but was wondering if there is a programmatic way of getting the grid name without passing it

 

        public static GridToolBarCommandFactory<T> SuperSearch<T>(this GridToolBarCommandFactory<T> builder, string gridName, string title = "Super Search...") where T : class
        {
            builder.Spacer();
            builder.Custom().ClientTemplate($"<span class=\"k-input k-input-md k-rounded-md k-input-solid\" style=\"width: 400px;\"><input id=\"superSearch\" name=\"superSearch\" oninput=\"window.top.superSearch('{gridName}')\" class=\"k-input-inner\" autocomplete=\"off\" placeholder=\"{title}\"/></span>");

            return builder;
        }

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 03 Jun 2025, 01:20 PM

Hi Dale,

 

Thank you for reaching out.

Yes, passing the grid name is a good approach. Generally, there is the Component property which might prove helpful:

    public class GridToolBarSettings : JsonObject        
    {
        public GridToolBarSettings(WidgetBase grid)
        {
            Commands = new List<GridActionCommandBase>();
            Component = grid;               
        }  

        public WidgetBase Component { get; }
But please note that creating custom classes is outside of our support boundaries, even if they are inherited directly from Telerik. Our components are getting actively updated and we cannot guarantee that changing some internal functionality will affect customly inherited classes. You can use Partial views to achieve a commonly repeated definition.

I hope this information was beneficial and on point.

 

Regards,
Eyup
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Grid
Asked by
Dale
Top achievements
Rank 1
Iron
Answers by
Eyup
Telerik team
Share this question
or