码迷,mamicode.com
首页 > 其他好文 > 详细

KendoUI Row绑定下拉菜单

时间:2017-07-27 18:16:59      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:ica   pre   tco   editor   down   uri   绑定   drop   data   

 $("#SalleGrid").kendoGrid({
        dataSource: {
            transport: {
                read: {
                    dateType: ‘application/json‘,
                    url: ‘/SalesTicket/Single/GG‘,
                    type: ‘POST‘,
                },

            },
            schema: {
                model: {
                    id: "ID",
                    fields: {
                        ID: { editable: false, nullable: true,},
                        Name: { defaultValue: { TouristTypeID: 4, TouristName: "Beverages" } }
                    }
                }
            },
            batch: true,
            pageSize: 15,
        },
        height: 200,
        selectable: "multiple",
        sortable: true,
        columns: [
             { field: "ID", title: "ID", hidden: true },
           { title: ‘门票代码‘, field: ‘TicketCode‘, editor: categoryDropDownEditor, template: "#=Name.TouristName#" },
         
        ],
        editable:true,
    });

 

function categoryDropDownEditor(container, options) {   
    $(‘<input required name="‘ + options.field + ‘"/>‘)
        .appendTo(container)
        .kendoDropDownList({
            autoBind: false,
            dataTextField: "TouristName",
            dataValueField: "TouristTypeID",
            dataSource: {
                transport: {
                    read: {
                        dataType: "json",
                        url: "/SalesTicket/Single/GetSelectList",
                    }
                }
            }
               
        }); }

Grid后台:

 [HandlerAjaxOnly]
        public ActionResult GG()
        {
            IQueryable<TouristTypeEntity> tourist = touristtypeApp.GetTouristTypeData();
            var result = from x in tourist
                         select
       new
       {
           ID = x.TouristTypeID,
           Name = new
           {
               TouristTypeID = x.TouristTypeID,
               TouristName = x.Name
           }
       };
            return Json(result);
        }

 

DropDownList:

public ActionResult GetSelectList()
        {
            IQueryable<TouristTypeEntity> tourist = touristtypeApp.GetTouristTypeData();
            var result = from x in tourist
                         select
       new
       {          
               TouristTypeID = x.TouristTypeID,
               TouristName = x.Name
     
       };
            return Json(result.ToList(),JsonRequestBehavior.AllowGet);
        }

 

KendoUI Row绑定下拉菜单

标签:ica   pre   tco   editor   down   uri   绑定   drop   data   

原文地址:http://www.cnblogs.com/xinyibufang/p/7246031.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!