jiaoye6789
jiaoye6789
2016-07-25 09:04

Easyui加载datagrid的,combobox的首选项的值作为queryParams传到后台

 <script type="text/javascript">
 $(function () {
            $('#parkArea').combobox({
                url: '/VenueVehicle/LoadParkingAreas',
                valueField: 'PARKING_AREA_ID',
                textField: 'NAME',
                panelHeight: 'auto',
                editable: false,
                onLoadSuccess: function () {
                    var data = $('#parkArea').combobox('getData');
                    if (data.length > 0) {
                        $('#parkArea').combobox('select', data[0].PARKING_AREA_ID);
                    }
                }
            });
            $('#dgVenueVehicle').datagrid({
                fitColumns: true,
                url: '/VenueVehicle/LoadVenueVehicle',
                idField: 'ENTERING_ID',
                toolbar: '#tb',
                autoSizeColumn: true,
                nowrap: true,
                resizable: true,
                pagination: true,
                singleSelect: true,
                rownumbers: true,
                queryParams: { parkArea: $('#parkArea').combobox('getValue') },
                pageSize: 10,
                pageNumber: 1,
                pageList: [10, 15, 20],
                columns: [[
                    { field: 'VEHICLE_LICENSE_PLATE_NO', title: '车牌号码', width: 100 },
                     { field: 'VEHICLE_TYPE_NAME', title: '车辆类型', width: 100 },
                     { field: 'ENTER_TIME', title: '进入时间', width: 100 },
                     { field: 'PARK_AREA_NAME', title: '停车区域', width: 100 }
                ]],
                onClickRow: function (index, row) {
                    if (row.PIC_URL == null) {
                        $('#imgEntering').attr("src", "");
                    }
                    else {
                        var enteringUrl = row.PIC_URL;
                        var enteringName = enteringUrl.match(/[^\/]*$/)[0];
                        $('#imgEntering').attr("src", enteringUrl.replace(enteringName, $URL.encode(enteringName)));
                    }
                },
                onLoadSuccess: function (data) {
                    var dd = $.parseJSON(data)
                    alert(data.rows[0].VEHICLE_LICENSE_PLATE_NO);
                }
            });
        })
 </script>

方法好像是加载完combobox后,并没有加载onLoadSuccess,就加载了datagrid

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答