After working on a multi-view page for a couple of months, the shareholders have recently added a requirement that the back button work "as expected". I've found the SPA/layout/router functionality of KendoUI, which appears to be what I need, but I'm rather lost as to how to convert my existing functionality to use it. Also, please note that this is my first time using KendoUI, or working w/ a single page application, so my initial solution is probably not ideal in many respects.
I've hosted an example version of my application here: app.smarteru.com/custom/kendo/index.cfm, as well as attaching the source code as a zip file. I've stripped out a lot of the extraneous UI bits, but I've left the util.js fully intact (including functions that won't actually be called by the example), so you can see the general idea of the page as a whole.
I would appreciate some general guidance/an example of how I can get my tile and list views working within the layout/router framework. You'll notice in the generateCourseView in util,js, I'm handing the hiding/showing of the tile and list display divs on my own (as well as hiding other views, which I've removed from the example for simplicity).
I do have a few specific questions, in addition to the general request for guidance:
Hi,
Can you help me with my dojo here? In this experiment I'm trying to redirect to the login-view. Doesn't work, neither in the change event nor in the route callbacks. Plus using the change event produces an infinite loop (on FF38).
Regards,
Kasimier Buchcik
var
router1 =
new
kendo.Router();
router1.route(
"/test1/"
,
function
(){
alert(
"test1"
);
});
var
router2 =
new
kendo.Router();
router2.route(
"/test2/"
,
function
(){
alert(
"test2"
);
});
router1.start();
router2.start();
I notice strange behaviour in Google Webmaster Tools. Google crawler found some links that doesn't exists. I first though that Google doesn't handle properly my (ajax) sitemap.xml, until I notice this 404 error in Webmaster Tools:
URL:https://domerus.si/realestates/*id
The only place where string "realestates/*id" appears is in init kendo router route:
Application.router.route(
'/realestates/*id'
,
function
(id)
{
if
(id) //load content and add it to the DOM
Application.navigate(
"realestates"
,
null
, { name: id, fileName:
"realestate"
, parameters: { ID: id } });
});
I already asked how can I fix this on Google support, but since I am starting to feel kendo is responsible for this, I am also posting it here.
Hi,
We are trying to use a spa project template that Kendo put up on the Visual Studio Gallery https://visualstudiogallery.msdn.microsoft.com/924c3074-ceab-4be4-87e1-e9e4fd4b6d61 , The problem we are having is when building the requirejs app with the optimizer r.js, the app runs and no errors but the templates are not rendering, I can see that the templates have been included in the built file. The app and templates render no problem when not using the optimizer.
I have attached a project with the problem,
Templates not rendering when using built file
<script src="@Url.Content("~/Scripts/require.js")" data-main="@Url.Content("~/App/main-built")"></script>
Templates rendering with non built file
<script src="@Url.Content("~/Scripts/require.js")" data-main="@Url.Content("~/App/main")"></script>
Can anyone shed some light on this please?
Thanks
N.
I am receiving this error when attempting to use Kendo UI Mobile /SPA features:
Error: Your kendo mobile application element does not contain any direct child elements with data-role="view" attribute set. Make sure that you instantiate the mobile application using the correct container
I have one index.html page:
<!DOCTYPE HTML>
<
html
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
title
>Global Client Dashboard</
title
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"
>
<!--
<
link
rel
=
"shortcut icon"
href
=
"images/favicon.png"
>
<
link
rel
=
"apple-touch-icon"
href
=
"images/apple-touch-icon.png"
>
-->
<!-- CSS -->
<
link
rel
=
"stylesheet"
href
=
"css/main.css"
>
<
link
rel
=
"stylesheet"
href
=
"css/login.css"
>
<
link
rel
=
"stylesheet"
href
=
"js/libs/kendoui/styles/kendo.mobile.all.min.css"
>
<!-- jQuery -->
<!-- Using the jQuery in Kendo UI -->
<
script
src
=
"js/libs/kendoui/js/jquery.min.js"
></
script
>
<!-- Angular JS -->
<
script
src
=
"js/libs/kendoui/js/angular.min.js"
></
script
>
<!-- Kendo UI -->
<
script
src
=
"js/libs/kendoui/js/kendo.all.min.js"
></
script
>
<!-- application scripts -->
<
script
src
=
"js/app.js"
></
script
>
</
head
>
<
body
style
=
"display: none;"
kendo-mobile-application
k-hash-bang
=
"true"
ng-app
=
"gcdApp"
>
<!-- Default View - needed for routing -->
<
div
data-role
=
"view"
></
div
>
<!-- Header and Footer -->
<
kendo-mobile-layout
k-id
=
"'default'"
>
<
kendo-mobile-header
>
<
kendo-mobile-nav-bar
>
<
kendo-view-title
></
kendo-view-title
>
<!-- <kendo-mobile-button class="about-button" k-align="'right'" href="views/about.html">About</kendo-mobile-button> -->
</
kendo-mobile-nav-bar
>
</
kendo-mobile-header
>
<
kendo-mobile-footer
>
<
kendo-mobile-tab-strip
>
<
a
href
=
"views/accounts.html"
data-icon
=
"home"
>Home</
a
>
<
a
href
=
"views/about.html"
data-icon
=
"info"
>About</
a
>
<
a
href
=
"views/more.html"
data-icon
=
"more"
>More</
a
>
</
kendo-mobile-tab-strip
>
</
kendo-mobile-footer
>
</
kendo-mobile-layout
>
<
script
>
new kendo.mobile.Application($(document.body), { initial: "views/login.html" });
</
script
>
<!-- Standard Worklight Stuff -->
<
script
src
=
"js/initOptions.js"
></
script
>
<
script
src
=
"js/main.js"
></
script
>
<
script
src
=
"js/messages.js"
></
script
>
<!-- Controllers -->
<
script
src
=
"js/controllers/controllers.js"
></
script
>
<
script
src
=
"js/controllers/accounts.js"
></
script
>
<
script
src
=
"js/controllers/metrics.js"
></
script
>
</
body
>
</
html
>
I followed this tutorial to get this page up and running:
http://blogs.telerik.com/kendoui/posts/13-08-01/kendo-ui-mobile-remote-views-and-separate-html-files
I found this post in the forum, however, I am not sure how to plug into my index.html to get to work:
http://www.telerik.com/forums/problems-getting-kendo-to-work
I was hoping to get some help to get this to work correctly.
Thanks!
Dan
I have been tasked with adding a Login page to a Kendo UI Mobile project. The Login page needs to appear first when the user opens the application. I also need to make this application an SPA application, using the router (or not using the router is easier).
Here is the existing index.html:
<!DOCTYPE HTML>
<
html
>
<
head
>
<
meta
charset
=
"UTF-8"
>
<
title
>Global Client Dashboard</
title
>
<
meta
name
=
"viewport"
content
=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0"
>
<!--
<
link
rel
=
"shortcut icon"
href
=
"images/favicon.png"
>
<
link
rel
=
"apple-touch-icon"
href
=
"images/apple-touch-icon.png"
>
-->
<!-- CSS -->
<
link
rel
=
"stylesheet"
href
=
"css/main.css"
>
<
link
href
=
"js/libs/kendoui/styles/kendo.mobile.all.min.css"
rel
=
"stylesheet"
/>
<!-- jQuery -->
<!-- Using the jQuery in Kendo UI -->
<
script
src
=
"js/libs/kendoui/js/jquery.min.js"
></
script
>
<!-- Angular JS -->
<
script
src
=
"js/libs/kendoui/js/angular.min.js"
></
script
>
<!-- Kendo UI -->
<
script
src
=
"js/libs/kendoui/js/kendo.all.min.js"
></
script
>
<!-- application scripts -->
<
script
src
=
"js/app.js"
></
script
>
</
head
>
<
body
style
=
"display:none;"
kendo-mobile-application
k-hash-bang
=
"true"
ng-app
=
"gcdApp"
>
<!--application UI goes here-->
<!-- Accounts -->
<
kendo-mobile-view
id
=
"accounts"
k-title
=
"'Customer Accounts'"
k-layout
=
"'default'"
ng-controller
=
"AccountsController"
>
<
kendo-mobile-list-view
id
=
"accountslist"
class
=
"item-list"
k-template
=
"templates.accountsTemplate"
k-data-source
=
"gcdAccounts.accountsDataSource"
>
</
kendo-mobile-list-view
>
</
kendo-mobile-view
>
<!-- Metrics - Historical Performance -->
<
kendo-mobile-view
id
=
"metrics"
k-transition
=
"'slide'"
k-title
=
"'Historical Performance'"
k-layout
=
"'default'"
ng-controller
=
"MetricsController"
k-on-show
=
"setCurrentItem(kendoEvent)"
>
<
kendo-mobile-header
>
<
kendo-mobile-nav-bar
>
<
kendo-mobile-back-button
k-align
=
"'left'"
>Accounts</
kendo-mobile-back-button
>
<
kendo-view-title
>Historical Performance</
kendo-view-title
>
</
kendo-mobile-nav-bar
>
</
kendo-mobile-header
>
<
kendo-mobile-content
>
<
h2
>{{gcdAccounts.currentItem.custname}}</
h2
>
<!-- Client Experience Metric - Transaction -->
<
div
style
=
"margin-left:5px;"
>
<
div
kendo-chart
class
=
"chart-halfwidth chart-left-top"
k-title
=
"{ text: 'Client Experience Metric - Transaction' }"
k-legend
=
"{ position: 'bottom' }"
k-series-defaults
=
"{ type: 'column', stack: true, categoryField: 'month', labels: {visible: false} }"
k-series="[
{ field: 'q2avg', name: 'Avg', color: 'green' },
{ field: 'miss', name: 'Miss', color: 'red' }
]"
k-value-axis
=
"{ min:0, max:10, plotBands: [{ from: 8.0, to: 8.05, color: 'black' }] }"
k-category-axis
=
"{ labels:{ visible:true } }"
k-data-source
=
"cexpDataSource"
k-series-click
=
"transactionClicked"
>
</
div
>
</
div
>
<!-- Hardware Billing Accuracy -->
<
div
style
=
"margin-left:5px;"
>
<
div
kendo-chart
class
=
"chart-halfwidth chart-right-top"
k-title
=
"{ text: 'HW Billing Accuracy' }"
k-legend
=
"{ position: 'bottom' }"
k-series-defaults
=
"{ type: 'column', stack: { type: '100%' }, categoryField: 'month', labels: {visible: false} }"
k-series="[
{ field: 'okcnt', name: 'Make', color: 'green' },
{ field: 'defects', name: 'Miss', color: 'red' }
]"
k-value-axis
=
"{ plotBands: [{ from: 0.95, to: 0.955, color: 'black' }] }"
k-category-axis
=
"{ labels:{ visible:true } }"
k-data-source
=
"hwbillDataSource"
>
</
div
>
</
div
>
<!-- Dispute Cycle Time -->
<
div
style
=
"margin-left:5px;"
>
<
div
kendo-chart
class
=
"chart-halfwidth chart-left"
k-title
=
"{ text: 'Dispute Cycle Time' }"
k-legend
=
"{ position: 'bottom' }"
k-series-defaults
=
"{ type: 'column', categoryField: 'month', labels: {visible: false} }"
k-series="[
{ field: 'cycletime', name: 'Cycle Time', color: 'green' }
]"
k-value-axis
=
"{ min:0, max:60, plotBands: [{ from: 30, to: 30.3, color: 'black' }] }"
k-category-axis
=
"{ labels:{ visible:true } }"
k-data-source
=
"dctDataSource"
>
</
div
>
</
div
>
<!-- On Time Delivery -->
<
div
style
=
"margin-left:5px;"
>
<
div
kendo-chart
class
=
"chart-halfwidth chart-right"
k-title
=
"{ text: 'On Time Delivery' }"
k-legend
=
"{ position: 'bottom' }"
k-series-defaults
=
"{ type: 'column', stack: { type: '100%' }, categoryField: 'month', labels: {visible: false} }"
k-series="[
{ field: 'okcnt', name: 'Make', color: 'green' },
{ field: 'defects', name: 'Miss', color: 'red' }
]"
k-value-axis
=
"{ plotBands: [{ from: 0.95, to: 0.955, color: 'black' }] }"
k-category-axis
=
"{ labels:{ visible:true } }"
k-data-source
=
"otdDataSource"
>
</
div
>
</
div
>
<!-- Services Billing Accuracy -->
<
div
style
=
"margin-left:5px;"
>
<
div
kendo-chart
class
=
"chart-halfwidth chart-left"
k-title
=
"{ text: 'Services Billing Accuracy' }"
k-legend
=
"{ position: 'bottom' }"
k-series-defaults
=
"{ type: 'column', stack: { type: '100%' }, categoryField: 'month', labels: {visible: false} }"
k-series="[
{ field: 'okcnt', name: 'Make', color: 'green' },
{ field: 'defects', name: 'Miss', color: 'red' }
]"
k-value-axis
=
"{ plotBands: [{ from: 0.95, to: 0.955, color: 'black' }] }"
k-category-axis
=
"{ labels:{ visible:true } }"
k-data-source
=
"svcbillDataSource"
>
</
div
>
</
div
>
</
kendo-mobile-content
>
</
kendo-mobile-view
>
<!-- Header and Footer -->
<
kendo-mobile-layout
k-id
=
"'default'"
>
<
kendo-mobile-header
>
<
kendo-mobile-nav-bar
>
<
kendo-view-title
></
kendo-view-title
>
<!-- <kendo-mobile-button class="about-button" k-align="'right'" href="views/about.html">About</kendo-mobile-button> -->
</
kendo-mobile-nav-bar
>
</
kendo-mobile-header
>
<
kendo-mobile-footer
>
<
kendo-mobile-tab-strip
>
<
a
href
=
"#!accounts"
data-icon
=
"home"
>Home</
a
>
<
a
href
=
"views/about.html"
data-icon
=
"info"
>About</
a
>
<
a
href
=
"#!"
data-icon
=
"more"
>More</
a
>
</
kendo-mobile-tab-strip
>
</
kendo-mobile-footer
>
</
kendo-mobile-layout
>
<!-- Templates -->
<!-- k-on-click="gcdAccounts.addToCart(kendoEvent, dataItem)" -->
<
script
id
=
"accountsTemplate"
type
=
"text/x-kendo-template"
>
<
a
class
=
"details-link"
data-role
=
"listview-link"
href
=
"\#!metrics?id={{dataItem.id}}"
>
{{ dataItem.custname }}
</
a
>
</
script
>
<!-- Standard Worklight Stuff -->
<
script
src
=
"js/initOptions.js"
></
script
>
<
script
src
=
"js/main.js"
></
script
>
<
script
src
=
"js/messages.js"
></
script
>
<
script
type
=
"text/javascript"
>
WL.Logger.debug("Loading main page");
</
script
>
<!-- Controllers -->
<
script
src
=
"js/controllers/controllers.js"
></
script
>
<
script
src
=
"js/controllers/accounts.js"
></
script
>
<
script
src
=
"js/controllers/metrics.js"
></
script
>
</
body
>
</
html
>
I have a few questions:
1. What determines, in the above .html, the first page/view that will appear?
2. How do I add an existing login.html into this page?
3. If I am to use the router, how to I add this feature to the existing index.html? Does each view become a template and how would I do that?
4. Once the login page is authenticated/passes, how do I open the Accounts view? Does this need to be put into a router or not?
I have been reviewing examples online, but I don't see samples on how to accomplish what I need to do.
Thanks!
Dan
I have a few questions:
1. With Kendo UI and its routing features, can they be broken into separate .html pages, so not to have all code in one index.html? Or does it all have to be on one .html page with templates, routing, controllers, etc.? I wanted to keep the index.html separate and easy to read and keep all other pages in a "views" folder.
2. Is it better to use Angular routing with Kendo UI features or does it not work correctly?
I see with Angular, you can use a placeholder:
<
div
ng-view>
</
div
>
gcdApp.config([
'$routeProvider'
,
function
($routeProvider) {
$routeProvider.
when(
'/login'
, {
templateUrl :
'views/login.html'
,
controller :
'LoginController'
}).
when(
'/loginSuccess'
, {
templateUrl :
'views/sushi.html'
,
controller :
'LoginSuccessController'
}).
otherwise({
redirectTo :
'/login'
,
});
;
} ]);
If there are any demos/tutorials that show exactly what I am looking for, please let me know. Or if you can provide code that spells all this out, I would really appreciate this. I am new to the Kendo UI SPA/Routing coding/processes and I can understand Angular a little better.
Thanks!
Dan
var
app = angular.module(
'App'
, [
'ngRoute'
]);
var
busyIndicator =
new
WL.BusyIndicator(
'content'
, {
text :
"Loading ..."
,
bounceAnimation :
false
,
fullScreen :
true
,
minDuration : 3,
textColor :
"black"
,
opacity : 1,
strokeOpacity : 0.25
});
app.factory(
"busyIndicator"
,
function
() {
return
busyIndicator;
});
app.config([
'$routeProvider'
,
function
($routeProvider) {
$routeProvider.
when(
'/module'
, {
templateUrl :
'views/modules.html'
,
controller :
'ModuleController'
}).
when(
'/module/:moduleId'
, {
templateUrl :
'views/level.html'
,
controller :
'LevelController'
}).
when(
'/module/:moduleId/:levelId'
, {
templateUrl :
'views/quiz.html'
,
controller :
'QuizController'
}).
when(
'/rank'
, {
templateUrl :
'views/rank.html'
,
controller :
'RankController'
}).
when(
'/help'
, {
templateUrl :
'views/help.html'
,
controller :
'HelpController'
}).
when(
'/result'
, {
templateUrl :
'views/result.html'
,
controller :
'ResultController'
}).
when(
'/nick'
, {
templateUrl :
'views/nickname.html'
,
controller :
'NickController'
}).
when(
'/login'
, {
templateUrl :
'views/login.html'
,
controller :
'LoginController'
}).
when(
'/loginSuccess'
, {
templateUrl :
'views/loginSuccess.html'
,
controller :
'LoginSuccessController'
}).
otherwise({
redirectTo :
'/login'
,
});
;
} ]);
..
<
script
src
=
"js/app.js"
></
script
>
</
head
>
<
body
>
<
div
ng-class
=
"tabClass"
>
<
div
class
=
"app_view ng-view"
>
</
div
>
</
div
>
</
body
>
...