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.
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
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.
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
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"
);
}
}
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.
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.
<
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