zoukankan      html  css  js  c++  java
  • KendoUI Row绑定下拉菜单

     $("#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);
            }
  • 相关阅读:
    更新user的方法
    django里的http协议
    django的第一个问题
    一台机器上配置多个ip地址;访问宿主机上的容器
    virtio 之后的数据直连
    virtio是啥子
    perf的采样模式和统计模式
    perf的统计模式: 突破口: x86_perf_event_update
    arp_filter的验证,使用net namespace
    阿里云Windows 2008一键安装包配置php web环境图文安装教程(IIS+Php+Mysql)
  • 原文地址:https://www.cnblogs.com/xinyibufang/p/7246031.html
Copyright © 2011-2022 走看看