4. Implementing routes
With Kendo UI we also can make router which navigates user between the application pages. To make your router you should to make three steps:
- Router initializing
- Setting routes
- Starting the router
- Router initializing
1
var
router =
new
kendo.Router();
- Setting routes
123
router.route(
"/openme"
,
function
() {
alert(
"Hello world!"
);
});
- Starting the router
1
$(
function
() { router.start(); });
For example: mywebsite.com#/openmeThis is very simple way how to make your routes but you can use more functionality like “route parameters”, “optional route parameters”, “route navigation” and etc.
http://ssnenov.wordpress.com/2013/03/24/single-page-up-with-kendo-ui/
----
EDIT:
correcion el router.navigate("...") agrega # y lo que tiene en el argumento en el URL del direcciones ademas llama a route(...) con el mismo valor pero sin la #.
<script>
var router = new kendo.Router();
router.route("/foo", function () {
console.log("welcome to foo");
});
$(function () {
router.start();
router.navigate("/foo");
});
</script>
aparece en la url
http://localhost:4740/admin/EliminarRouter.aspx#/foo
No hay comentarios:
Publicar un comentario