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

Grid - Current vs Selected items

3 Answers 414 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Marcin asked on 20 Jan 2016, 11:20 AM

Hi,

 I try to achieve feature, where the user can select multiply rows in the grid (e.g. to open a 'multi-edit' dialog), and additionally there should be displayed details for the currently selected item (generally - the currently clicked one).

I'm trying the following snippet:

var tmpCurrent = e.sender.current(); // this seems to be set to some object

currentItem: kendo.data.ObservableObject;
currentItem = e.sender.dataItem(tmpCurrent); //this is always null

 

Another question - is there any way to get the class object the datasource was initially filled with from the ObservableObject?

In a datasource's transport read function I prepare the array of DictionaryKey objects and then pass as the success result:

options.success(this.dictionaryKeys);

Is there any option to get those object when reading the select() items? This will be much easier to write in TypeScript having an instance of known class instead of using get("prop_name") construction in the code...

 

Best regards

Marcin Danek

3 Answers, 1 is accepted

Sort by
0
Marcin
Top achievements
Rank 1
answered on 20 Jan 2016, 12:09 PM

Hi,

the question in part of getting the current item is closed. I managed to get the parentElement and then the dataItem.

 The only current question is, whether is it possible to get the object of custom type from ObservableObject...

Best regards

Marcin Danek

0
Accepted
Boyan Dimitrov
Telerik team
answered on 22 Jan 2016, 11:41 AM

Hello Marcin,

 

The data item returned by the data method of the Kendo UI DataSource is observable object, but they contain all properties and values from your original object. Using . "dot" notation you are able to access the property value. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Marcin
Top achievements
Rank 1
answered on 22 Jan 2016, 11:55 AM

Hello Boyan,

Thank You for Your response.

 Yes, I know that in clear JS the 'dot' notation works. But using the power of TypeScript intellisense is impossible, as the 'class' is hidden (wrapped) with the ObservableObject, and I see there is no way to cast it to my class.

This is just a little inconvenience, that as I see with my starting work with HTML5 and JS technologies, is impossible to workaround.

Best regards

Marcin Danek

 

Tags
Grid
Asked by
Marcin
Top achievements
Rank 1
Answers by
Marcin
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Share this question
or