Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Problem of size, sorting and freezing
03/04/2011
20:00
Avatar
Kris-I
Member
Members
Forum Posts: 9
Member Since:
12/01/2010
sp_UserOfflineSmall Offline

Hello,

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 );
        }
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
72 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information