c 后台输出easyui html,EasyUI——实现展示后台数据代码
下面是View顯示代碼:
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
$(function () {
var editRow = undefined;
$("#tb1").datagrid({
fitColumns: true,
striped: true,
//這里需要接收【總行數(shù)total】和【數(shù)據(jù)組rows】的【JSON格式】的數(shù)據(jù){total:23,rows:[{},{}]}
url: "/UserExpression/GetAllUserInfos",
singleSelect: false,
pagination: true,
rownumbers: true,
pageSize: ,
pageList: [, , ],
columns: [
[// u.Id,u.UName,u.Pwd,u.Remark,u.SubTime
{ title: "用戶名", field: "UName", allgn: "center", width: },
{ title: "密碼", field: "Pwd", allgn: "center", width: },
{ title: "備注", field: "Remark", allgn: "center", width: },
{ title: "保存時(shí)間", field: "SubTime", allgn: "center", width: },
{
title: "編輯", field: "xx", allgn: "center", width: , formatter: function (value, row, index) {
var btn = '修改|刪除';
return btn;
}
},
]
],
//在數(shù)據(jù)加載成功的時(shí)候觸發(fā)。
onLoadSuccess: function (data) {
$('.Update').linkbutton({
text: '修改',
iconCls: 'icon-edit',
plain: true,//是否顯示邊線
onClick: function () {
var zhi = $("#tb1").datagrid("getSelections");
window.location.href = '/HomeText/Edit?id=' + zhi[].productID;
}
})
$('.delete').linkbutton({
text: '刪除',
iconCls: 'icon-edit',
plain: true,//是否顯示邊線
onClick: function () {
var zhi = $("#tb1").datagrid("getSelections");
$.ajax({
type: 'POST',
dataType: 'json',
url: '/HomeText/DeleteConfirmed?id=' + zhi[].productID,
success: function (data) {
$("#tb1").datagrid("reload");
}
})
}
})
},
toolbar: [
{
text: "添加",
iconCls: "icon-add",
handler: function () {
window.open("/HomeText/Create")
}
},
{
text: "刪除",
iconCls: "icon-cancel",
}
],
})
})
下面是Controller后臺代碼:
using IBLL;
using SQLModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MVC展示數(shù)據(jù).Controllers
{
public class UserExpressionController : Controller
{
//利用spring.net在Config里面進(jìn)行配置,這樣就不用new對象了
public IUserInfo UserInfoBLL2 { get; set; }
#region 加載用戶的數(shù)據(jù)
public ActionResult Index()
{
return View();
}
public ActionResult GetAllUserInfos()
{
//根據(jù)分頁顯示數(shù)據(jù)
int pageSize = Request["rows"] == null ? : int.Parse(Request["rows"]);
int pageIndex = Request["page"] == null ? : int.Parse(Request["page"]);
//--------------------------------第幾頁,每頁幾條,根據(jù)id進(jìn)行查詢
var data = UserInfoBLL2.LoadByPage(pageIndex, pageSize, n => n.Id)
//-----避免重復(fù)查詢
.Select(u => new { u.Id, u.UName, u.Pwd, u.Remark, u.SubTime });
//總的數(shù)據(jù)條數(shù)
int total = UserInfoBLL2.Load().Count();
var result = new { total=total,rows=data};
return Json(result, JsonRequestBehavior.AllowGet);
}
#endregion
}
}
部分視圖展示:
easyUI + servlet 展示datagrid數(shù)據(jù)列表
1:在jsp頁面添加所用easyUI的js和css 2.前臺代碼示例:
【開源】OSharp框架解說系列(2.2):EasyUI復(fù)雜布局及數(shù)據(jù)操作
OSharp是什么? OSharp是個(gè)快速開發(fā)框架,但不是一個(gè)大而全的包羅萬象的框架,嚴(yán)格的說,OSharp中什么都沒有實(shí)現(xiàn).與其他大而全的框架最大的不同點(diǎn),就是OSharp只做抽象封裝,不做實(shí)現(xiàn).依 ...
隨機(jī)推薦
WIN7下java環(huán)境的搭建
首先,你應(yīng)該已經(jīng)安裝了 java 的 JDK 了,筆者安裝的是:jdk-7u7-windows-x64 接下來主要講怎么配置 java 的環(huán)境變量,也是為了以后哪天自己忘記了做個(gè)備份 1.進(jìn)入“計(jì)算機(jī) ...
Codeforces Round #337 (Div. 2) C. Harmony Analysis 構(gòu)造
C. Harmony Analysis 題目連接: http://www.codeforces.com/contest/610/problem/C Description The semester i ...
java學(xué)習(xí)筆記 (9) —— Struts2 國際化
1.Test.java package com.i18n; import java.util.Locale; public class Test1 { public static void main( ...
Ubuntu14.04配置arm-linux-gcc 4.4.3交叉編譯環(huán)境
首先下載交叉編譯:不多說,直接貼地址了?http://arm9download.cncncn.com/mini2440/linux/arm-linux-gcc-4.4.3-20100728.tar.g ...
poj 3311 Hie with the Pie(狀態(tài)壓縮dp)
Description The Pizazz Pizzeria prides itself or more (up to ) orders to be processed before he star ...
matlab和C語言的break及continue測試
break和continue語句 有兩個(gè)附加語句可以控制while和for循環(huán):break和continue語句.break語句可以中止循環(huán)的執(zhí)行和跳到end后面的第一句執(zhí)行,而continue只中止 ...
Windows下caffe的python接口配置
主要是因?yàn)?發(fā)現(xiàn)很多代碼是用python編寫的,在這里使用的python安裝包是anaconda2. 對應(yīng)下載地址為: https://www.continuum.io/downloads/ 安裝py ...
io使用的設(shè)計(jì)模式
File f = new File("c:/a.txt"); 1. FileInputStream fis = new FileInputStream(f); 2. Reader ...
pygme 安裝
輸入pip install pygame-1.9.3-cp36-cp36m-win32.whl ModuleNotFoundError: No module named 'requests' pip ...
總結(jié)
以上是生活随笔為你收集整理的c 后台输出easyui html,EasyUI——实现展示后台数据代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 父亲节用计算机给惊喜,2015父亲节的惊
- 下一篇: 中国科学院计算机网络信息中心科学数据中心