Kendo dropdown on changing value cannot bind to view model - kendo-ui

I have got problem with setting selected value of view model when changing option in dropdown.
I do not want to describe it because it will be easier just to show code by http://jsbin.com/ritor/9/edit
Just want to mention about what is wrong
When I am changing dropdown value there is a error in console
Uncaught TypeError: undefined is not a function
and view-model value is unchanged.
I have no idea what is going wrong with my code.
Solution:
Ok a little change make code works:
http://jsbin.com/deyuse/8/edit

You have told the drop down list template to bind to a value that it does not have context to. Additionally, you have told the grid column to bind to the incorrect value. It should be selectedValue not FieldValue. Why is fieldValues a function?
Furthermore, you are trying to implement an editable grid. Your implementation is not configured for that. Please follow the documentation at Kendo UI.
Here's your corrected JsBin example.
Update: After deeper review, your implementation needs considerable refactoring. I've revised my answer.

Related

How to get a data in a text box by the index change of DropDownList in asp.net?

I am doing this using layer architecture and the code and problem is below. I want to get the course title in the text box by a course code of the DropDownList. The problem is null reference. Please help me to solve this problem. N.B: Course Code and course title placed in the same table.
It looks like you're passing the course title into the SQL instead of the course code. If you are passing the course code, it may be an idea to rename your parameters to avoid confusion.
How are you building the select list? Are you sure that the value and text are correctly assigned?

Kendo-UI min/max setters not a function

Kendo-UI slider min/max functions when used as setters they throw an error
Uncaught TypeError: slider.max is not a function at line 6
Does anyone know if this will be fixed soon and is there a workaround for it right now?
It seems that Kendo UI Slider doesn't have min/max methods and also setOptions will not update the range, observable in this Dojo demo.
I'll strongly recommend to post your findings in Kendo UI issue tracker:
https://github.com/telerik/kendo-ui-core/issues
As to a possible workaround, my assumption is that you will need to recreate the component with new min/max range, smth like that:
http://dojo.telerik.com/iFEQI

Kendo UI Grid inline edit not work when use ObservableArray as data for data source

I'm trying to use a kendo.data.ObservableArray as data for data source of the grid. It shows ok. When edit inline, change a field, then cancel, the values are changed. When clicking edit, then click edit on another row, the last one remains in the edit mode. Sometimes cancel not work. On the array it works as expected.
I took the Kendo UI Demo, http://demos.telerik.com/kendo-ui/grid/editing-inline, to reproduce the issue. Here is the issue: http://dojo.telerik.com/uLiCi/2
Does anyone have any idea why so strange behavior?
In my opinion, it should work with both, array and observable array.
Thanks in advance

Kendo Grid Edit form - Changing control value programmatically is ignored on submit

I'm using Telerik Kendo UI Professional. I have a grid with an edit template, and several controls on it. I ran into a weird little requirement, where I needed to programmatically set the value of one of the controls, based on another control being changed. The actual change of value seems to happen just fine. However, when I submit the form to save changes, the new, programmatically-set value is ignored; it sends the original value instead. If the user changes the value himself, the new value is submitted just fine.
Here is a sample:
http://dojo.telerik.com/#wittca/otoxO
This is not my original code, but it shows the same problem. In this version, upon opening the edit popup, I programmatically modify the value of the UnitsInStock KendoNumericTextBox. Then when I save the form, I would expect to see the new value, but I still see the old value in the grid. So it does not take the programmatically-generated new value.
My original code is trying to set the value of a KendoComboBox, when one of the other controls changes, and the same situation happens. I didn't have time to create the exact same situation, but most likely if we can fix that dojo sample, the same fix would apply to my ComboBox.
Here is the response I got from Telerik support:
You will need to trigger the change event as well, as the Grid listens for it in order to update the value. Please see the updated example here:
http://dojo.telerik.com/UjUkE
var units = e.container.find("[name='UnitsInStock']").data("kendoNumericTextBox");
units.value( <insert new value here> );
units.trigger("change");
The key line of code is that last one; that manually triggers the "change" event on the control, which forces the Grid to update the value.
This fix also works with my original problem involving ComboBoxes.
He is a solution for you:
If you change the edit function that you have from:
edit: function (e) {
var units = e.container.find("[name='UnitsInStock']").data("kendoNumericTextBox");
var unitsValue = units.value();
units.value(unitsValue+1);
}
to this:
edit: function (e) {
var val = e.model.UnitsInStock;
e.model.set("UnitsInStock", val+ 1);
}
It will bind the updated value for you.
Here is my updated code for you to test:
http://dojo.telerik.com/OHaKA/2

How to setup a Kendo UI grid with a dropdownlist in ASP.NET MVC

Before proceeding to this community to ask my question, I have thoroughly searched google, bing, and also the Kendo UI documentation for information and seem to get nothing like I want.
I want to setup a grid(a strongly typed one) with one of its columns bound to a property of List type on the model. This column should display this property in a dropdownlist. This is where the problem lies.
All the examples I have seen always used a viewdata type to hold the data of IEnumerable type.
Can some one show me how to set this up plus I find the ClientTemplate method so confusing in this respect.
I'm a newbie to Kendo UI btw.
Thanks.

Resources