martes, 9 de septiembre de 2014

KENDO ROUTER EJEMPLOS

<%@ Page Title="" Language="C#" MasterPageFile="~/Layout.Master" AutoEventWireup="true" CodeBehind="kendoSPA.aspx.cs" Inherits="SCPServicio.kendoSPA" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SidebarContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsContent" runat="server">
 <script>
     var router = new kendo.Router();

     router.route("/myPage", function(){
         console.log("the /myPage route was triggered!");
     });
     // #/myPage
     //http://localhost:30233/kendoSPA.aspx#/myPage

     //con un parametro
     router.route("/foo/:id", function (id) {
         console.log("the /foo/" + id + " route was triggered!");
     });
     //http://localhost:30233/kendoSPA.aspx#/foo/1
     // #/foo/1

     router.route("/foo/:bar/baz/:quux/:id", function (bar, quux, id) {
         console.log(bar, quux, id);
     });
     //varios parametros
     // ... matches routes like #/foo/this/baz/is/awesome
     //http://localhost:30233/kendoSPA.aspx#/foo/this/baz/is/awesome
     router.start();
     console.log("Hola");
 </script>

    <a id="link" href="#">Click me</a>
    <script>
        var router = new kendo.Router()

        router.route("/items/:category/:id", function (category, id) {
            console.log(category, "item with", id, " was requested");
        });

        $(function () {
            router.start();
            $("#link").click(function () {
                router.navigate("/items/books/59");
                return false;
            });
            //Al hacer clic se llena con una hash antes #/items/books/59
            //http://localhost:30233/kendoSPA.aspx#/items/books/59
        });
</script>

<script>
    var router = new kendo.Router();
    router.route("/items/:category/:id", function (category, id, params) {
        console.log(category, "item with id", id, "was requested by", params.user);
    });

    $(function () {
        router.start();
        // ...
        router.navigate("/items/books/59?user=John");
    });
</script>

    <a id="A1" href="#">Click me</a>
<script>
    var router = new kendo.Router();

    router.route("/items/:category/:id", function (category, id, params) {
        console.log(category, "item with", id, " was requested by", params.user);
    });

    router.bind("change", function (e) {
        console.log("change event", e);
    });

    $(function () {
        router.start();
        $("#link").click(function () {
            router.navigate("/items/books/59?user=John");
            return false;
        });

    });
</script>

</asp:Content>

No hay comentarios:

Publicar un comentario