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

Problem with bindings and remote views

0 Answers 131 Views
Application
This is a migrated thread and some comments may be shown as answers.
RedTears75
Top achievements
Rank 1
RedTears75 asked on 10 Oct 2012, 05:06 PM
Hi,

i got the issue that when navigating to an external view a jscript error is thrown complaining that data for a binding could not be found.
-- Uncaught Error: Unable to parse bindings. Message: ReferenceError: Username is not defined; Bindings value: value: Username  
--

This happens when the user tries to navigate to an external page like "/Studies/List/".

Actually I use kendo.bind to display the data on the view (but it's the same problem with knockout).

Basically my Views look like this:

--
<div data-role="layout" data-id="buttons" >
        <header data-role="header">
            <div data-role="navbar">                
                <span data-role="view-title"></span>
             </div>
        </header>        
        <!--View content will render here-->                  
    <footer data-role="footer">
        <div data-role="tabstrip">
        <a href="#home" data-icon="home">Home</a>
            <a href="#details" data-icon="home">Locale View</a>
            <a href="@( Url.Content("~/Studies/List") )" data-icon="mostrecent">External</a>
        </div>
    </footer>
    </div>

<div data-role="view" data-title="Home" data-layout="buttons" id="home">
    <div id="dataView">
    <span data-bind="text: name"></span>, <span data-bind="text: vorname"></span>
    </div>
</div>

<div data-role="view" data-title="Details" data-layout="buttons" id="details">
    <span data-bind="text: name"></span>
</div>
--

and here is the minimal JScript for it:

<script type="text/javascript">
var app = new kendo.mobile.Application(document.body, {
    transition: 'slide'
});


var data = kendo.observable({
    name: "LastName",
    vorname: "FirstName"
});

kendo.bind($("#dataView"), data);
kendo.bind($("#details"), data);
</script>

--


so, whenever the user is in the home screen (v1) hits the 3rd tab-button and the "external" view (v2) is loaded, v2 is never displayed because jscript complains about the missing data that is bound in v1.

Really strange. Did I mention that it doesn't matter if you use kendo.bind or the knockout-version? It doesn't, so i guess it's a problem from either the views or the application (or all two both :) )
Does anyone have a guess on how to solve this?

Up to now i tried to remove the bindings when navigating away with data-hide  ( ko.cleanNode() ) but that does not help.
Setting the attr "data-bind" to "" could work but that's indiscutable.

Any help would be really great.

No answers yet. Maybe you can help?

Tags
Application
Asked by
RedTears75
Top achievements
Rank 1
Share this question
or