Telerik Forums
Kendo UI for jQuery Forum
1 answer
109 views

Background: I'm using external templates as described here for different pages in my SPA. Those pages consist of script tags with type "text/x-kendo/template". I load those templates into my index.html file and create Kendo views for each of the pages.

 

For some reason, I am not able to use the Kendo angular directives (e.g., "<input kendo-date-time-picker/>") inside my template scripts - they don't load properly. Using the same directives in my index.html file works perfectly though, so there shouldn't be a problem with dependencies. I suspect that the problem is either that there's some incompatibility with having the angular directives inside a View or that I'm not calling the right functions on the View. Right now, I'm just doing "layoutName.showIn("#content", viewName);" for the latter.

 

If anyone knows a fix, that would be super helpful. Otherwise, pointing me to an example of an SPA using external templates and the Kendo Angular directives would be helpful as well.

 

Julia
Top achievements
Rank 1
 answered on 06 Jul 2016
4 answers
80 views

Hello,

I was looking today at the blog post http://www.telerik.com/blogs/please-respect-the-back-button

when running the sample http://jsbin.com/OHemASes/3 i was able to see that pressing back button after navigating to the "Orders" links works as expected when 

moving between pages.

However, after moving to a specific page I have copied the url (http://output.jsbin.com/OHemASes/3#/orders/5) and paste it to a new browser instance.

The router did direct the app to Orders view but the selected page was 1.

Shouldn't page 5 supposed to be selected in this scenario ?

thx

Sagi

 

Alex Gyoshev
Telerik team
 answered on 25 Dec 2015
3 answers
68 views

I need to set useNativeScrolling = true on a particular view (for Android only) and can't seem to figure it out. I assumed it would be as easy as:

if (device.platform === "iOS")
//        {
console.log("ios");
    app.view().useNativeScrolling = false;
}

But that doesn't seem to do anything. I'm sure it's simple.

Petyo
Telerik team
 answered on 01 Dec 2015
3 answers
40 views

I noticed that template-based Views are not destroyed as Router is navigating through them - they are simply taken out of the DOM. Sometimes this might be desired behavior, but not always. What is the recommended approach for destroying views, when Router is navigation out of them? This also would require complete disconnect from any subscriptions to ViewModel if they are kept in memory.

 Thanks,

 Sam

Petyo
Telerik team
 answered on 21 Jul 2015
1 answer
89 views

I can't seem to get app.navigate to switch to a local view. No errors in console.

Please tell me why this simple example doesn't work.

HTML:

<div data-role="view" data-layout="default" id="journalDefault" data-before-show="doesNeedLogin">
    Journal Entries
</div>
 
<div data-role="view" data-layout="default" id="journalAddNew">
    Add Entry. Get ID from Listview.
</div>
 
<div data-role="view" data-layout="default" id="journalLogin">
    Need to login.
</div>

JS:

function doesNeedLogin(e)
{
    var isLoggedIn = false;
     
    if (isLoggedIn)
    {
        alert("Logged In");
    }
    else
    {
        alert("Not logged in");
         
        //show them login view
        app.navigate("#journalLogin");
    }
}

Petyo
Telerik team
 answered on 17 Jul 2015
1 answer
127 views

I use Kendo MVC mobile view in my layout view.

When I try to render body in the content function nothing is happening.

I expect that it would just render all views / partial views that I have in any of the page that are rendered in RenderBody().

Kendo MVC MobileView declaration:

@(Html.Kendo().MobileView()
       .Name("drawer-home")
       .Layout("drawer-layout")
       .Content(@<text>
                    <div class="content">
                        @RenderBody()
                    </div>
                    @Html.Action("Footer", "Layout")
                </text>)
)

RenderBody() data example:

<div class="mainWarrper">
    @if (Model != null)
    {
        if (Model.CarouselViewModel != null)
        {
            Html.Partial("_CarouselView", @Model.CarouselViewModel);
        }

        if (Model.OnPageMenu.Any())
        {
            Html.Partial("_Menu", @Model.Menu);
        }

        if (Model.Category != null)
        {
            Html.Partial("_Category", @Model.Category);
        }
    }
</div>

When I debug this code everything every thing seems to run and execute as it should, but still nothing is rendered to my website and I'm getting an empty "mainWarrper" div while the @Html.Action("Footer", "Layout") rendered as it should.

 

Thank you.

Dekel
Top achievements
Rank 1
 answered on 28 Jun 2015
1 answer
77 views

Is there any way to determine the type of event from a function callback? I assumed there'd be a type defined but that doesn't seem to be the case. So if I define data-init="init" on my view and had this js:

 

init:function(e){
console.log(e.type, e.view.id, e);
}

 

e.type is not defined. I tried inspecting the object and couldn't find a parameter for it.

Petyo
Telerik team
 answered on 08 Jun 2015
1 answer
65 views
<div id="wms-app"></div>
 
<script>
  var router, layout;
   
    var loginView = new kendo.View("view-login", { show: function(e){
                                                        alert("login");
                                                        $('input').keypress(function(event) {
                                                            if(event.which == 10 || event.which == 13) {
                                                                event.preventDefault();
                                                                window.location = document.getElementById('textButton').href;
                                                            }
                                                        });
                                                   }, wrap: false });  
     
    // setup layout
    layout = new kendo.Layout("layout-template1", { show: function(e){
                                                        alert("temp");
                                                        var pN = document.getElementById("wms-content").parentNode;
                                                        pN.style = "height:100%";
                                                    } });
   
    layout.render("#wms-app");
 
    // define a default view
    layout.showIn("#wms-content", loginView);
     
    // define a router with a basic routes
    router = new kendo.Router();
</script>
   
<script id="view-login" type="text/x-kendo-template">
    <div id="loginBox">
        <div id="login-header">
            LAPS
        </div>
 
        <input id='inputuser' class="k-textbox one-edge-shadow" placeholder="Username"></input>
        <input id='inputpasswd' type="password" class="k-textbox one-edge-shadow" placeholder="Password"></input>
         
        <a id="textButton" class="k-button one-edge-shadow" href="#/main">LOGIN</a>
    </div>
</script>
   
<script id="layout-template1" type="text/x-kendo-template">
    <div id="wms-content"></div>
</script>

 

 The alert for the layout gets triggerd but the alert for the view not! why??

 

Thank you

Petyo
Telerik team
 answered on 10 Apr 2015
5 answers
125 views
Hi
  This seems like such a simple thing but I can't find out how to get this working

I have a view, data-zoom="true", containing a long image. I just want it to zoom out when the view opens such that it contains the full width of the image, the height is small in comparison.

I've tried things like

var scroller = $("#detailSection").data("kendoMobileView").scroller;
scroller.zoomOut();

(this actually zooms in)

and trying to get the -webkit-transform

//var scroll = scroller.scrollElement.css("-webkit-transform");

but no avail. 

Is there a simple way of doing this? It must be a common request

thanks


Petyo
Telerik team
 answered on 17 Mar 2015
1 answer
138 views
We are using kendo mobile with our app and encountered the following issue: Our views are using the data-init to specify one time functions to be called for a view. However our app requires user-login, which means that one user can log in then log out and log in again as other user.

On every login we need to reset the data-init events so they will be called for each user that logs in.

We use it to handle cases where in the same session a user visits the view several time and we need to init the view only once for this session. But on the next login, we also need the init event to be executed once.

We did not find how to reset the init-event in kendo's documentation - so it will fire again after a second (or third...) login.
Kiril Nikolov
Telerik team
 answered on 20 Feb 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?