Grid Native and Command Columns

0 Answers 103 Views
Grid
eric
Top achievements
Rank 1
eric asked on 12 Aug 2021, 11:53 PM

Hi Team,

Have command columns been removed from Grid Native?

Previously I have used them with the wrapper component.  In the native I tried the below:


        return {
            editingId: false,
            columns: [
                {field:'item_name'},
                {field:'price'},
                {field:'stock'},
                {
                    editable: false,
                    command:[
                        {name:"destroy","text": "destroy", click: this.destroyItem}
                    ]
                }
            ]
        };

 

I would expect a column to be rendered with a button for destroy and the click handler called on click.  In the native component the grid is just showing an empty column with no buttons.

Thanks,

Eric.

eric
Top achievements
Rank 1
commented on 13 Aug 2021, 02:30 AM

I have been able to get this to work now using a cell property in the column definition and rendering a custom view component.  Is this the proper approach?

 

EF.

Petar
Telerik team
commented on 13 Aug 2021, 06:46 AM

Hi Eric. 

Yes, this is the proper approach. Using the cell property and defining a custom column template is the way you can add commands to the Native Grid component. 

For reference, here is a demo project from our documentation.

eric
Top achievements
Rank 1
commented on 13 Aug 2021, 06:47 AM

Ahh thankyou Petar. Yes that helps!
Petar
Telerik team
commented on 13 Aug 2021, 06:54 AM

You are welcome!

Our Native Grid Documentation has a lot of different examples you can find useful.  

No answers yet. Maybe you can help?

Tags
Grid
Asked by
eric
Top achievements
Rank 1
Share this question
or