Skip to content

Instantly share code, notes, and snippets.

@chadmyers
Created March 15, 2010 22:44
Show Gist options
  • Save chadmyers/333433 to your computer and use it in GitHub Desktop.
Save chadmyers/333433 to your computer and use it in GitHub Desktop.
// This is an example of one of the types of objects
// that'll get put into the "items" property of the
// GridResultsViewModel DTO above
// Each "item" is a row. That is, each EntityDTO is a
// row in the grid
// the "cells" property is what gets bound to the
// cells in each row
// It's up to you to get the display value for each cell
public class EntityDTO
{
public Guid id { get; set; }
public string[] cell { get; set; }
}
public class GridResultsViewModel
{
public int total { get; set; }
public int lastpage { get { return total; } set { } }
public bool viewrecords {get{ return true;} set {}}
public int page { get; set; }
public int records { get; set; }
public IEnumerable items { get; set; }
public string Description { get; set; }
}
// This is a snippet of the options we pass to
// jqGrid. We have a bunch of events bound, but
// that wouldn't be interesting to you
height: "auto",
url: gridDefinition.Url,
datatype: 'json',
mtype: 'GET',
readjustHeaderWidths: true,
colNames: columnNames,
colModel: columnModel,
rowNum: 10,
rowList: [3, 10, 20, 30],
loadui: "disable",
postData: initalPostData,
sortorder: "asc",
viewrecords: true,
jsonReader: {
repeatitems: true,
root: "items",
cell: "cell",
id: "id"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment