Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.rtl.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" />
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.dataviz.default.min.css" rel="stylesheet" type="text/css" />
  
<link href="http://cdn.kendostatic.com/2013.2.716/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://cdn.kendostatic.com/2013.2.716/js/kendo.all.min.js"></script>
<script src="http://demos.kendoui.com/content/shared/js/products.js"></script>
  
  <script src="http://codeseven.github.io/toastr/toastr.js"></script> 
  <link href="http://codeseven.github.io/toastr/toastr.css" rel="stylesheet" type="text/css" />  
  
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div id="validator">
    <div id="grid"></div>
  </div>
<script>
$(document).ready(function () { 
  var dataSource = new kendo.data.DataSource({
    data: products,
    schema: {
      model: {
        fields: {
          ProductName: { type: "string" },
          UnitPrice: { type: "number" },
          UnitsInStock: { type: "number" },
          Discontinued: { type: "boolean" }
        }}
    },
    pageSize: 20
  });
  
  var grid = $("#grid").kendoGrid({
    dataSource: dataSource,
    pageable: true,
    height: 500,
    toolbar: ["create"],
    columns: [
      { field: "ProductName", title: "Product Name", width: "100px" }, 
      { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "100px" },
      { field: "UnitsInStock", title:"Units In Stock", width: "100px" },
      { field: "Discontinued", width: "100px" },
      { command: "edit", width: "100px"}
    ],
    editable: "inline",
    save: function(e){
     if(e.model.UnitPrice > 1)
     { 
        toastr.error("Item is too expensive, set a lower price","Error")
        e.preventDefault();
     } 
    }
  }).data("kendoGrid"); 
});
    
</script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
apoffpro
0viewers