发布于 2016-08-26 21:08:57 | 161 次阅读 | 评论: 0 | 来源: 网友投递
EasyUI jQuery UI插件
jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签。
public class CustomJsonResult:JsonResult
{
public override void ExecuteResult(ControllerContext context)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
HttpResponseBase response = context.HttpContext.Response;
if (!String.IsNullOrEmpty(ContentType))
{
response.ContentType = ContentType;
}
else
{
response.ContentType = "application/json";
}
if (ContentEncoding != null)
{
response.ContentEncoding = ContentEncoding;
}
if (Data != null)
{
#pragma warning disable 0618
//跨域调用需要修改json格式jsoncallback
if (context.HttpContext.Request.Params.AllKeys.Contains("jsoncallback"))
{
String callback = context.HttpContext.Request.Params["jsoncallback"];
response.Write(callback+"("+JsonConvert.SerializeObject(Data)+")");
}
else
{
response.Write(JsonConvert.SerializeObject(Data));
}
#pragma warning restore 0618
}
}
}
//datagrid
$('#dg').datagrid({
url:'http://localhost:9000/ManagementSystem/ListCurrent?department=sss&jsoncallback=?',
pageNumber: 1,
pageSize: 20,
pageList: [20, 40, 60, 80, 100],
onDblClickRow: function(rowIndex) {
edit();
}
});