Exemplo n.º 1
0
        public ActionResult Index()
        {
            var panel = new Panel();

            panel.ConfigLocation();

            var table = DataTable.Define <Models.DataTableItemModel>(o => o.Id).Create(Url.Location(IndexDataSource));

            table.SetSelectedParameterName("id");
            table.AddActionTable(Url.Location(Create));
            table.AddActionTable(Url.Location(Delete)).SupportParameter().Confirm("是否删除").NeedSelected();
            table.AddActionTable("提示", "$app.alert(id)");
            table.AddActionItem(Url.Location(Details)).OnClientCondition(ItemActionClient.Hide, "data.Id < 3").OnClientCondition(ItemActionClient.Disable, "data.Id > 5");
            table.AddActionItem(Url.Location(Edit));
            table.AddActionItem(Url.Location(Delete)).Confirm("是否删除");
            table.AddActionItem(Url.Location <DataTablesItemController>(o => o.Index));
            table.AddActionItem("提示", "$app.alert(id)");
            table.AddActionItem(Url.Location(Show));
            table.AddActionItem(Url.Location(ShowAction));

            table.SetRowClassNameWhenClientCondition("alert-danger", "data.Id < 3");
            table.SetPageSize(20);
            table.AddSearchPanel(Url.Location(Index), "key", "");
            panel.Append(table);
            panel.Description = "注释内容";
            panel.SetSearch(Url.Location(Index), "key", Request["key"], "动态表格 示例");
            var result = new HtmlResult(panel.CreateGrid());

            result.SetQuickSearch(Url.Location(Index), "key", "动态表格 示例");
            return(result);
        }
Exemplo n.º 2
0
        public IActionResult Index(string key)
        {
            var panel = new Panel();

            panel.ConfigLocation();

            var table = DataTable.Define <Models.TableListModel>(o => o.Id).Create(Url.Location(IndexDataSource));

            table.AddActionTable(Url.Location(Export));
            table.AddActionTable(Url.Location(Create));
            table.AddActionItem(Url.Location(Change));
            table.SetRowClassNameWhenClientCondition("alert-danger", "data.Id < 3");
            table.SetPageSize(20);
            panel.Append(table);
            panel.Description = "动态表格";
            panel.SetSearch(Url.Location(Index), "key", key, "示例");
            var result = new HtmlResult(panel.CreateGrid());

            result.SetQuickSearch(Url.Location(Index), "key", "示例");
            return(result);
        }