Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function () {
  2.     $("#grid").jqGrid({
  3.         url: "/TodoList/GetTodoLists",
  4.         datatype: 'json',
  5.         mtype: 'Get',
  6.         colNames: ['Id', 'Task Name', 'Task Description', 'Target Date', 'Severity', 'Task Status'],
  7.         colModel: [
  8.             { key: true, hidden: true, name: 'Id', index: 'Id', editable: true },
  9.             { key: false, name: 'TaskName', index: 'TaskName', editable: true },
  10.             { key: false, name: 'TaskDescription', index: 'TaskDescription', editable: true },
  11.             { key: false, name: 'TargetDate', index: 'TargetDate', editable: true, formatter: 'date', formatoptions: { newformat: 'd/m/Y' } },
  12.             { key: false, name: 'Severity', index: 'Severity', editable: true, edittype: 'select', editoptions: { value: { 'L': 'Low', 'M': 'Medium', 'H': 'High' } } },
  13.             { key: false, name: 'TaskStatus', index: 'TaskStatus', editable: true, edittype: 'select', editoptions: { value: { 'A': 'Active', 'I': 'InActive' } } }],
  14.         pager: jQuery('#pager'),
  15.         rowNum: 10,
  16.         rowList: [10, 20, 30, 40],
  17.         height: '100%',
  18.         viewrecords: true,
  19.         caption: 'Todo List',
  20.         emptyrecords: 'No records to display',
  21.         jsonReader: {
  22.             root: "rows",
  23.             page: "page",
  24.             total: "total",
  25.             records: "records",
  26.             repeatitems: false,
  27.             Id: "0"
  28.         },
  29.         autowidth: true,
  30.         multiselect: false
  31.     }).navGrid('#pager', { edit: true, add: true, del: true, search: false, refresh: true },
  32.         {
  33.             // edit options
  34.             zIndex: 100,
  35.             url: '/TodoList/Edit',
  36.             closeOnEscape: true,
  37.             closeAfterEdit: true,
  38.             recreateForm: true,
  39.             afterComplete: function (response) {
  40.                 if (response.responseText) {
  41.                     alert(response.responseText);
  42.                 }
  43.             }
  44.         },
  45.         {
  46.             // add options
  47.             zIndex: 100,
  48.             url: "/TodoList/Create",
  49.             closeOnEscape: true,
  50.             closeAfterAdd: true,
  51.             afterComplete: function (response) {
  52.                 if (response.responseText) {
  53.                     alert(response.responseText);
  54.                 }
  55.             }
  56.         },
  57.         {
  58.             // delete options
  59.             zIndex: 100,
  60.             url: "/TodoList/Delete",
  61.             closeOnEscape: true,
  62.             closeAfterDelete: true,
  63.             recreateForm: true,
  64.             msg: "Are you sure you want to delete this task?",
  65.             afterComplete: function (response) {
  66.                 if (response.responseText) {
  67.                     alert(response.responseText);
  68.                 }
  69.             }
  70.         });
  71. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement