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>
  
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div id="grid"></div>
  
<script>
$(document).ready(function () { 
  var dataSource1 = new kendo.data.DataSource({
    data: products,
    schema: {
      model: {
        fields: {
          ProductName: { type: "string" },
          UnitPrice: { type: "number" },
          UnitsInStock: { type: "number" },
          Category: { defaultValue: { CategoryID: 1, CategoryName: "Beverages"} },
          Discontinued: { type: "boolean" }
        }}
    },
    pageSize: 20
  });  
  var grid = $("#grid").kendoGrid({
    dataSource: dataSource1,
    pageable: true,
    height: 500,
    toolbar: ["create"],
    columns: [ 
      { field: "ProductName", title: "Product Name", width: "200px",
      editor: DropDownEditor
      },
      { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "200px"},
      { field: "UnitsInStock", title:"Units In Stock", width: "100px" },
      { field: "Discontinued", width: "100px" },
      { command: ["edit", "destroy"], title: "&nbsp;", width: "172px" }],
    editable: "incell"
  }).data("kendoGrid");
    function DropDownEditor(container, options) {
        
        if(options.model.Discontinued){
            var input = $('<input required data-text-field="ProductName" data-value-field="ProductName" data-bind="value:ProductName"/>')
            input.appendTo(container);
            input.kendoDropDownList({
                autoBind: false,
                dataSource: {
                    type: "odata",
                    transport: {
                        read: "http://demos.kendoui.com/service/Northwind.svc/Products"
                    }
                }
            });
        }
        else{
            var input = $('<input type="text" class="k-input k-textbox" name="ProductName" data-bind="value:ProductName">'); 
            input.appendTo(container); 
        }
    };
  
  
});
    
</script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
apoffpro
0viewers