当前位置: 首页>>代码示例>>C#>>正文


C# DataSource.read方法代码示例

本文整理汇总了C#中DataSource.read方法的典型用法代码示例。如果您正苦于以下问题:C# DataSource.read方法的具体用法?C# DataSource.read怎么用?C# DataSource.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataSource的用法示例。


在下文中一共展示了DataSource.read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnReady

        static void OnReady()
        {
            // create a template using the above definition
            var template = Kendo.template(new jQuery("#template").html());
            var dataSource = new DataSource(new DataSourceConfiguration
            {
                pageSize = 10,
                data = People.createRandomData(500),
                // subscribe to the CHANGE event of the data source
                change = () =>
                    {
                        // update the max attribute of the "page" input
                        new jQuery("#page").attr("max", [email protected]<DataSource>().totalPages());
                        new jQuery("#people tbody").html(Kendo.render(template, [email protected]<DataSource>().view()));
                    }
            });
            // read the data
            dataSource.read();
            new jQuery("#apply").click(() =>
                {
                    var page = JsContext.parseInt(new jQuery("#page").val().As<JsString>());// ,10)
                    // validate the page - it must be a number within the allowed range
                    if (JsContext.isNaN(page) || page < 1 || page > dataSource.totalPages())
                    {
                        HtmlContext.window.alert(Kendo.format("Page must be a number between 1 and {0}", dataSource.totalPages()));
                        return;
                    }
                    //// query the remote service
                    dataSource.query(new DataSourceConfiguration
                    {
                        page = page,
                        pageSize = 10,
                        //TODO: sortOPtions
                        sort = new { field = new jQuery("#order").val(), dir = new jQuery("#dir").val() }

                    });
                });
            //initialize dropdownlist components
            new jQuery("#order").kendoDropDownList();
            new jQuery("#dir").kendoDropDownList();
        }
开发者ID:fjgandrade,项目名称:sharpkit,代码行数:41,代码来源:LocalOperations.cs

示例2: OnReady

 static void OnReady()
 {
     // create a template using the above definition
     var template = Kendo.template(new jQuery("#template").html());
     var movies = new JsArray<Movie> {
         new Movie { rank = 1, rating = 9.2, year = 1994, title = "The Shawshank Redemption" },
         new Movie { rank = 2, rating = 9.2, year = 1972, title = "The Godfather" },
         new Movie { rank = 3, rating = 9, year = 1974, title = "The Godfather = Part II" },
         new Movie { rank = 4, rating = 8.9, year = 1966, title = "Il buono, il brutto, il cattivo." },
         new Movie { rank = 5, rating = 8.9, year = 1994, title = "Pulp Fiction" },
         new Movie { rank = 6, rating = 8.9, year = 1957, title = "12 Angry Men" },
         new Movie { rank = 7, rating = 8.9, year = 1993, title = "Schindler's List" },
         new Movie { rank = 8, rating = 8.8, year = 1975, title = "One Flew Over the Cuckoo's Nest" },
         new Movie { rank = 9, rating = 8.8, year = 2010, title = "Inception" },
         new Movie { rank = 10, rating = 8.8, year = 2008, title = "The Dark Knight" } 
     };
     var dataSource = new DataSource(new DataSourceConfiguration
     {
         data = movies,
         change = () => new jQuery("#movies tbody").html(Kendo.render(template, [email protected]<DataSource>().view()))
     });
     dataSource.read();
 }
开发者ID:fjgandrade,项目名称:sharpkit,代码行数:23,代码来源:Index.cs


注:本文中的DataSource.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。