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

Loading single items from a grid model

2 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 11 Jul 2014, 12:32 PM
Hi Guys,

So I have this grid, and when the user selects an item from the grid i would like to bind that data item to a detail view outside the grid.
The idea is that the user could then decide to remove the grid from the page but keep the detail view if they so choose but ultimately they are the same object so a grid row and the detail view share that object.
If either the table or the detail view are updated in any way then both are updated, but also my data source is a SignalR source so both need to be able to accept an update from the hub.

I put together a "broken" jsfiddle showing how far I have gotten so far.

http://jsfiddle.net/g2wYX/

I have noticed there are options like this ... http://www.telerik.com/forums/row-selected-event ... but that assumes I want to go back to the server. 
In my case the grid model already locally contains the full detail I need I just want to take a single item and bind that within a simple MVVM detail view.

Also, when a different item from the grid is selected I want that to then rebind the detail view to that item.

Any ideas?






2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 15 Jul 2014, 07:09 AM
Hello Paul,

I have reviewed the jsfiddle you have provided and it seems that your approach is valid. Indeed, in order to achieve the desired functionality, you will need to use a shared DataSource to populate both the grid and the details view. This will ensure that changes to the items will be propagated to both. However, in your sample I have noticed that the detail view is using incorrect binding. As you may know the value binding is design to work on input element. For text only elements, such as spans, you will need to use the text binding instead.

Regards,
Rosen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Paul
Top achievements
Rank 1
answered on 15 Jul 2014, 11:34 AM

Ah it looks like someone on stack overflow managed to solve the date problem too ...

http://jsfiddle.net/g2wYX/2/

Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Paul
Top achievements
Rank 1
Share this question
or