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

Get current row from dataSource change event

3 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 12 Feb 2014, 09:24 PM
I am doing inline editing of rows in my grid. I am trying to hook into the change event of the dataSource, but can't seem to figure out how to get the currently selected row within that dataSource change event.

I am using the dataSource change event to set a dirty flag on the page so we can know when we can update the changes in bulk (I am not updating as I change a row, but instead doing a bulk update of the list of changed items)

Thanks,
--Ed

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 13 Feb 2014, 09:20 AM
Hello Ed,

Did you tried to use the save event of the Grid? The currently edited model is passed to the event data and you can access it through the e.model property.

If you insist to use the change event of the DataSource you should have in mind that it is fired not only after item is edited. Please check if the action (e.action) is "itemchange" and search for the edited model in e.items array.

I hope this information will help.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ed
Top achievements
Rank 1
answered on 13 Feb 2014, 10:17 PM
Thanks Alexander,

The save event looks useful.

Once I'm in the event, how can I get a selector to that cell?  The incell editing has the non-edited look of a hyperlink.  When the link is clicked, it turns into a dropdownlist.

My issue is on IE, when we have a selection of blank, IE still shows a hyperlink for the space within the td tags.  At first, I was looking for somewhere I was putting a hyphen in there when there was an empty selection, but realized it was IE not dealing with the empty selection properly.  The fix is to modify the text-decoration when the user changes selection (if selection length = 0, set text-decoration to none, else set text-decoration to '' so it uses what is in the .css file).

So, I need to get the selector for that td.  How can I get that selector in either the save or change event.

Thanks,
--Ed
0
Ed
Top achievements
Rank 1
answered on 13 Feb 2014, 10:29 PM
this seems to do the trick

$(e.container[0]).css('text-decoration', 'none');
Tags
Grid
Asked by
Ed
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Ed
Top achievements
Rank 1
Share this question
or