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

Input Column not bond to data

2 Answers 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jennifer
Top achievements
Rank 1
Jennifer asked on 15 Mar 2021, 03:49 PM

I am new to Kendo Grid I am gring to show data from a API using kendo and then add an addtional column for Quanity that would be an input field.

The idea is a list of items that a person can add quaity to and then click add to cart and another script runs.The script would add the items to a separate area.

I believe I have the button working to add items but I am having difficulty with adding the input column as it is not bound to the data source.

Is this possible?  I have looked at using Row Templates but they seem to bond back to the data source.  Can some one help provide some idea?

2 Answers, 1 is accepted

Sort by
0
Jennifer
Top achievements
Rank 1
answered on 16 Mar 2021, 12:15 PM

To better explain what I am trying to do I would like to do something similar to the below example http://jsbin.com/ahiXoN/2/edit?html,output

however from what I understand the Unit in Stock is still pulling from the data source.  I would like this column to not be bound to data and be an additional column outside the data source.  The idea is that the once the user click add to cart a script will right that rows information including to Unit in Stock to another list.  

0
Georgi Denchev
Telerik team
answered on 18 Mar 2021, 10:20 AM

Hello Jennifer,

Thank you for the provided code sample.

If I understand correctly you want to have a column that is not bound to the DataSource in any way and it contains a simple input field. In MVC you can use a template to create such column and then use a ClientTemplate to add the input to it.

columns.Template(@<text></text>).ClientTemplate("<input class='numeric' type='number' step='1' />");

If you want to give a unique id to each input element, you can use one of the other grid fields which has unique values(for example the ID field).

columns.Template(@<text></text>).ClientTemplate("<input id='myCo_l#=ModelID#' class='numeric' type='number' step='1' />");

Here is a preview of the result:

Let me know if you have any questions.

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Jennifer
Top achievements
Rank 1
Answers by
Jennifer
Top achievements
Rank 1
Georgi Denchev
Telerik team
Share this question
or