Advertisement
Adrian_Apostolov

Untitled

Jan 12th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var dataSource = new kendo.data.DataSource({
  2.             transport: {
  3.                 read:  {
  4.                     url: 'api/users'
  5.                 },
  6.                 destroy: {
  7.                     url: 'users/delete',
  8.                     type: 'post'
  9.                 },
  10.                 update: {
  11.                     url: 'api/users',
  12.                     type: 'post'
  13.                 },
  14.                 create: {
  15.                     url: 'api/users',
  16.                     type: 'post'
  17.                 }
  18.             },
  19.             batch: true,
  20.             pageSize: 5,
  21.             schema: {
  22.                 model: {
  23.                     _id: "UserID",
  24.                     fields: {
  25.                         url: {type : "string"},
  26.                         username: {type: "string", validation: { required: true } },
  27.                         email: {type: "string", validation: { required: true } },
  28.                         roles: {type: "string"},
  29.                         password: {type: "string"}
  30.                     }
  31.                 }
  32.             }
  33.         });
  34.  
  35.  
  36.         vm.gridOptions = {
  37.             columns: [
  38.                 {
  39.                     template: "<img style='width: 60px; border-radius: 30%' src=#:data.pictureUrl#>",
  40.                     field: "pictureUrl",
  41.                     title: "Picture",
  42.                     width: 100
  43.                 },
  44.                 {field: "username", title: 'Username'},
  45.                 {field: "email", title: 'Email'},
  46.                 {field: 'roles', title: 'Role'},
  47.                 {field: 'password', title: 'Password'},
  48.                 { command: ["edit", "destroy"], title: "&nbsp;", width: "250px" }
  49.             ],
  50.             editable: "inline",
  51.             toolbar: ["create"],
  52.             pageable: true,
  53.             sortable: true,
  54.             dataSource: dataSource
  55.         }
  56.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement