Created
November 1, 2011 16:24
-
-
Save tucaz/1330999 to your computer and use it in GitHub Desktop.
jqGridWrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myNamespace = myNamespace || {}; | |
myNamespace.jqGridWrapper = function (gridId, pagerId, gridUrl, gridConfig) { | |
var grid = $(gridId).jqGrid({ | |
url: gridUrl, | |
datatype: "json", | |
colNames: gridConfig.colNames, | |
colModel: gridConfig.colModel, | |
rowNum: 10, | |
rowList: [10, 20, 30], | |
pager: pagerId, | |
sortname: gridConfig.sortName, | |
viewrecords: true, | |
sortorder: "asc", | |
caption: gridConfig.caption, | |
height: '100%', | |
width: '700px' | |
}); | |
return grid; | |
} | |
var myConfiguredGrid = new myNamespace.jqGridWrapper( | |
'#EventsGrid', | |
'#EventsPager', | |
'../Event/GetAllEvents/', | |
{ | |
colNames: ['Código', 'Nome do Evento', 'Cidade', 'Data de Início'], | |
colModel: [ | |
{ name: 'EventId', index: 'EventId', width: 50, search : true, stype: 'text', searchoptions: { sopt: ['eq', 'ne'] } }, | |
{ name: 'Name', index: 'Name', width: 250, search: true, stype: 'text', searchoptions: { sopt: ['eq', 'ne', 'bw', 'bn', 'ew', 'en', 'cn', 'nc']} }, | |
{ name: 'City', index: 'City', width: 150, search: true, stype: 'text', searchoptions: { sopt: ['eq', 'ne', 'bw', 'bn', 'ew', 'en', 'cn', 'nc']} }, | |
{ name: 'StartDate', index: 'StartDate', width: 80, search: false}], | |
sortname: 'EventId', | |
caption: "Eventos" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment