Home > Net >  O a LigerUI form from ajax to get the data instance
O a LigerUI form from ajax to get the data instance

Time:10-06

This is the background code

 public ActionResult GetVipInfo () 
{
UserBLL BLL=new UserBLL ();
Var dt=the BLL. GetUserInfoALL ();
Var a=the BLL. GetUserCount ();//access to table rows
String DTT="["; the foreach (DataRow Dr In dt. Rows)
DTT +="{UserID:" + "Dr [r]." UserID "ToString () +" ', the UserName: '" + Dr (" UserName "). The ToString () + "', UsrePass: '" + Dr (" UserPass "). The ToString (). The Replace ("' ", "\ ") + "'},"; DTT=DTT. Trim (', ') + "] ";//remove the last comma and closed json object array
Return Json (new {Rows=DTT}, JsonRequestBehavior AllowGet);
}


This is the front desk code, don't know how to get data into the LigerUI table
 $. Ajax ({
Url: '/VipList GetVipInfo,
Type: "get",
Datatype: "json",
Success: the function (data) {
Alert (JSON. Stringify (data))

},


Error: function (the message) {
Alert (" query failure ");
//LG. Tip (message);
}
});
The function finitGrid () {
Var ajaxurl=document. Location. Serach;
The debugger.
Var gridparms=[];
Gridparms. Push ({name: "UserID", display: "primary key"});
Gridparms. Push ({name: "UserName" to display: "name"});
Gridparms. Push ({name: "UserPass", display: "password"})
The grid=$(" # maingrid ".) ligerGrid ({
The columns: GetListColumns (),
The checkbox: false,
Url: ajaxurl,
Height: '100%',
HeightDiff: - 5,
DataAction: 'server'
UsePager: false,
Rownumbers: true,
FrozenRownumbers: false,
FixedCellHeight: false
});
}
})

Only the data

CodePudding user response:

No one????????

CodePudding user response:

Bosses,,,,

CodePudding user response:

Var GridData.//declare a GridData
$. Ajax ({
Url: '/VipList GetVipInfo,
Type: "get",
Datatype: "json",
Success: the function (data) {
Alert (JSON. Stringify (data))
GridData=https://bbs.csdn.net/topics/eval (" (" + data + ") ");//the data assigned to GridData
},


Error: function (the message) {
Alert (" query failure ");
//LG. Tip (message);
}
});
The function finitGrid () {
Var ajaxurl=document. Location. Serach;
The debugger.
Var gridparms=[];
Gridparms. Push ({name: "UserID", display: "primary key"});
Gridparms. Push ({name: "UserName" to display: "name"});
Gridparms. Push ({name: "UserPass", display: "password"})
The grid=$(" # maingrid ".) ligerGrid ({
The columns: GetListColumns (),
The checkbox: false,
Url: ajaxurl,
Height: '100%',
HeightDiff: - 5,
Data: $. The extend (true, {}, GridData),//add GridData
DataAction: 'server'
UsePager: false,
Rownumbers: true,
FrozenRownumbers: false,
FixedCellHeight: false
});
}
})
  •  Tags:  
  • C#
  • Related