jqgrid
那请问 前后台是怎么一个情况
@xinshen: jqgrid有现成的例子的。可以参考
jquery.jqGrid.min.js这个文件好像没有下载过来
@xinshen: http://www.trirand.com/blog/jqgrid/js/jquery.jqGrid.js 在IE下,直接可以下载
那在MVC上条件查询在前后台怎么交互
view 视图@modelIEnumerable<OrderDto>
@using(Html.Configurator("The grid should...")
.PostTo("FirstLook","Grid")
.Begin())
{
<ul>
<li>@Html.CheckBox("ajax",true,"make <strong>AJAX</strong> requests")</li>
<li>@Html.CheckBox("grouping",true,"allow <strong>grouping</strong> of data")</li>
<li>@Html.CheckBox("filtering",true,"allow <strong>filtering</strong> of data")</li>
<li>@Html.CheckBox("paging",true,"have <strong>pages</strong> with 10 items")</li>
<li>@Html.CheckBox("scrolling",true,"show a <strong>scrollbar</strong> when there are many items")</li>
<li>@Html.CheckBox("sorting",true,"allow <strong>sorting</strong> of data")</li>
<li>@Html.CheckBox("showFooter",true,"show footer")</li>
</ul>
<button class="t-button t-state-default" type="submit">Apply</button>
}
@(Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(o => o.OrderID).Width(100);
columns.Bound(o => o.ContactName).Width(200);
columns.Bound(o => o.ShipAddress);
columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120);
})
.DataBinding(dataBinding =>
{
dataBinding.Server().Select("FirstLook","Grid",new{ ajax =ViewData["ajax"]});
dataBinding.Ajax().Select("_FirstLook","Grid").Enabled((bool)ViewData["ajax"]);
})
.Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
.Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
.Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
.Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
.Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
.Footer((bool)ViewData["showFooter"])
)
Controller
namespaceTelerik.Web.Mvc.Examples
{
usingSystem;
usingSystem.Web.Mvc;
usingTelerik.Web.Mvc.Examples.Models;
publicpartialclassGridController:Controller
{
publicActionResultFirstLook(bool? ajax,bool? scrolling,bool? paging,bool? filtering,bool? sorting,
bool? grouping,bool? showFooter)
{
ViewData["ajax"]= ajax ??true;
ViewData["scrolling"]= scrolling ??true;
ViewData["paging"]= paging ??true;
ViewData["filtering"]= filtering ??true;
ViewData["grouping"]= grouping ??true;
ViewData["sorting"]= sorting ??true;
ViewData["showFooter"]= showFooter ??true;
returnView(GetOrderDto());
}
[GridAction]
publicActionResult _FirstLook()
{
returnView(newGridModel(GetOrderDto()));
}
}
}