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

Migrating from Telerik to Kendo - change event

4 Answers 95 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Gary Davis
Top achievements
Rank 2
Gary Davis asked on 17 Apr 2013, 06:28 PM
I am migrating from Telerik NumericTextBox to Kendo and have a question about the change event.

The page has multiple NumericTextBoxes in the grid rows so the change event needs the ID of the control to know which grid row is being changed.

The commented lines were from the Telerik version

function SpinnerQtyChange(e) {
    var target = this.element[0];
    var id = target.id.replace("QtySpinner_", "");
    var quantityJ = $(target).closest("td"); // Up to my <td> (Quantity)
    QtyChange(id, quantityJ, this.value(), e.oldValue);

    //var id = e.target.id.replace("QtySpinner_", "");
    //var quantityJ = $(e.target).parent().parent(); // Up to my <td> (Quantity)
    //QtyChange(id, quantityJ, e.newValue, e.oldValue);
}

The problem is the e.oldValue - where can I find it?

Thanks,
Gary Davis

4 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 18 Apr 2013, 02:04 PM
Hello Gary,


The oldValue property is no longer supported. Could you provide some additional information about the current scenario, so I could suggest you a suitable way to overcome the issue.

I am looking forward to hearing from you.

 

Regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gary Davis
Top achievements
Rank 2
answered on 18 Apr 2013, 02:30 PM
If there is no more oldValue, I will have to come up with a new technique. The current technique checks the difference in quantity and adjusts the item price and the footer subtotal and total by that amount. This is a shopping cart checkout page (see it live at http://www.blowitoutahere.com - pre-kendo version - stick on ?debugjs=on to see uncompressed scripts).

A solution will be to iterate thru all items to recalculate and update the subtotals and totals.

Is there a way to modify the cart grid data instead of modifying the table cell contents and then tell the grid to re-generate using the changed data? This is a server-side Telerik grid, not Kendo (yet) and but scollable so all the data is available (there can be 100's of items in the cart).

Thanks.
0
Dimiter Madjarov
Telerik team
answered on 22 Apr 2013, 11:27 AM
Hi Gary,


A possible workaround in a server bounded grid would be to add a hidden input in the template, which will hold the old value and could be retrieved in the change event of the NumericTextBox. In an Ajax bounded Kendo Grid, you could use the dataItem method, which will return the model for the current row (the old value would still be in the model).

Regarding your second question, this could not be achieved in a server bounded Grid. 

Regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gary Davis
Top achievements
Rank 2
answered on 23 Apr 2013, 08:13 PM
Thanks for your help, Dimiter.

Instead of adding hidden fields, I am able to calculate the old value by simply dividing the extended price by the unit price, both of which are already in the grid.

Gary
Tags
NumericTextBox
Asked by
Gary Davis
Top achievements
Rank 2
Answers by
Dimiter Madjarov
Telerik team
Gary Davis
Top achievements
Rank 2
Share this question
or