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

Access view.params in view

1 Answer 42 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Zachary
Top achievements
Rank 1
Zachary asked on 19 Jan 2013, 05:05 PM
I am struggling with access to the view.params in the view.

My code is simple - and i just want to dynamically populate a data- element on a button that resides in the header with view.params. I want to do this without using the template or the data-show function as both of these don't seem to work.. Template doesn't seem to work with the header, and my attempt to do this in the js function called at data-show the button doesnt work properly.. PLEASED HELP!

<!-- eventDetail view -------------------------------------------------------------------------------------------------->
<div data-role="view" id="view-eventDetail" data-show="getEventDetailData" data-title="eventDetail">
<header data-role="header">
<div data-role="navbar">
<span data-role="view-title"></span>
<a data-align="left" data-role="button" class="nav-button" href="#view-myEvents">Back</a>
                    <a data-align="right" data-role="button" class="nav-button" data-click="showEventUpdate" data-event_id="#=event_id#" data-user_id="view.params.user_id">Edit</a>
</div>
</header>

<div id="eventDetail"></div>
</div>

<script id="eventDetail-template" type="text/x-kendo-template">
         <div id="eventData">
<p>
Type: ${type}
</p>
<p>

Loc: ${loc}
</p>
<p>

Date/Time: ${stamp}
</p>
<p>
Share this ${share}

</p>



</div>

</script>

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 22 Jan 2013, 01:32 PM
Hi,

Attribute binding doesn't work for Kendo buttons. From the example you've sent, it seems you're trying to store information in the html elements.

I would recommend another approach to use view models. You may bind each view to a concrete view model.

Thus you can use different values in the view model and then send some of them to the next view. I wrote a demo for you, which demonstrates Kendo binding and parameter transfers among the views.

More information about Kendo mvvm pattern: here

Greetings,
Ivan Ivanov
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
Tags
General Discussion
Asked by
Zachary
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or