Forum
Topic RSS
20:00
12/01/2010
OfflineHello,
In an ASP.NET MVC 3 (with razor) application I use jqGrid (latest version). The first time I arrive on the page, no problem, but I have several trouble
1. Only one column is sortable, not 3 as configured in the code
2. All the links on the page a block (not usable), except the sorting on the column
3. the Width is not 100%
See the code below,
Thanks,
I use this code :
<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("#list2").jqGrid({
url: '/Customer/DynamicGridData/',
datatype: 'json',
mtype: 'GET',
colNames: ['Id', 'Code', 'Name'],
colModel: [
{ name: 'Id', index: 'Id', align: 'left', sortable: true },
{ name: 'Code', index: 'Code', align: 'left', sortable: true },
{ name: 'Name', index: 'Name', align: 'left', sortable: true }
],
pager: jQuery('#pager2'),
rowNum: 10,
rowList: [5, 10, 20, 50],
sortname: 'Code',
sortorder: 'desc',
viewrecords: true,
caption: 'My first grid'
});
});
</script>
<table id="list2" style="width:100%;"></table>
<div id="pager2" style="width:100%;"></div>
public ActionResult DynamicGridData(string sidx, string sord, int page, int rows)
{
IList<Client> list = GetList();
int pageIndex = Convert.ToInt32(page) - 1;
int pageSize = rows;
int totalRecords = list.Count;
var totalPages = (int)Math.Ceiling(totalRecords / (float)pageSize);
var jsonData = new
{
total = totalPages,
page,
records = totalRecords,
rows = (from item in list
select new
{
i = item.Id,
cell = new[]
{
item.Id.ToString(), item.Code.ToUpper(), item.Name
}
}).ToArray()
};
return Json(jsonData, JsonRequestBehavior.AllowGet );
}
Most Users Ever Online: 994
Currently Online:
12 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66
Log In
Home