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

Multiple Create Buttons in Toolbar - Set Values in Column based on button pressed

1 Answer 1173 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 13 Mar 2019, 02:39 PM

First question: Can I have multiple create buttons in a Grid toolbar?

Second question: Can the buttons set the value of a column (string value) based on the button pressed).

 

For example, I am trying to use buttons to control if the person being added is a contractor or an employee.  I have a column in my grid called Type (SwitchPersonType in datasource schema) and I want that column to be set based on the button pressed.  Is this possible?

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 14 Mar 2019, 09:17 AM
Hi David,

Yes, this is absolutely possible. Using the Toolbar template provided by the Grid, you can fully customize the content of the toolbar:
https://demos.telerik.com/kendo-ui/grid/toolbar-template

Then, you can call the addRow method when a button is clicked:
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/addrow

Open the corresponding cell in edit mode, access the textbox/combo/radio button/etc. element for the Type column and change its value depending on the individual button:
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/editcell

As a final step, you can optionally close the cell again:
https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/methods/closecell

I hope this will prove helpful. Give it a try and let me know how it goes. If you prefer, I can prepare a sample based on these steps.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or