您的位置:首页 > 产品设计 > UI/UE

MVC 用EasyUI

2015-09-21 19:26 351 查看
var _opItem = "Add";

var _rowIndex = 0;

var _Row;

var _pageIndex = 1;

var _pageSize = 20;

function GetCarType(pageIndex, pageSize) {

var BiGuidedPrice = $("#BiGuidedPrice").val() == "" ? 0 : $("#BiGuidedPrice").val();

var EiGuidedPrice = $("#EiGuidedPrice").val() == "" ? 0 : $("#EiGuidedPrice").val();

$('#CarType').datagrid({

title: '车型信息',

singleSelect: true, //是否单选

pagination: true, //分页控件

rownumbers: true, //行号

loadMsg: '数据加载中请稍后……',

queryParams: {

pageIndex: pageIndex, pageSize: pageSize,

sBrandName: $("#sBrandName").val(), sFirmName: $("#sFirmName").val(), sModelName: $("#sModelName").val(),

sDisplacementName: $("#sDisplacementName").val(), sTransmissionMmodelName: $("#sTransmissionMmodelName").val(),

BiGuidedPrice: BiGuidedPrice, EiGuidedPrice: EiGuidedPrice

},

url: '/BaseInfo/CarType/GetCarType',

idField: 'ID',

columns: [[

{ field: 'SFIRSTLETTER', title: '首字母', width: 40, align: 'center' },

{ field: 'SBRAND', title: '品牌', width: 100, align: 'center' },

{ field: 'SFIRM', title: '厂商', width: 120, align: 'center' },

{ field: 'SMODEL', title: '型号', width: 90, align: 'center' },

{ field: 'IYEARSSTYLE', title: '年代款型', width: 250, align: 'left' },

{ field: 'SDISPLACEMENT', title: '排量', width: 60, align: 'center' },

{ field: 'STRANSMISSIONMMODEL', title: '变速箱', width: 100, align: 'center' },

{ field: 'SENGINE', title: '发动机类型', width: 70, align: 'center' },

{ field: 'IGUIDEDPRICE', title: '指导价(万)', width: 70, align: 'center' }

]],

onLoadSuccess: function (data) {

if (data.total > 0) {

if (_opItem == "Add" || _rowIndex > data.rows.length) {

//默认选中首行

$(this).datagrid('selectRow', 0);

}

else {

$(this).datagrid('selectRow', _rowIndex);

}

//获取选中行

_Row = $("#CarType").datagrid("getSelected");

}

},

onClickRow: function (rowIndex, rowData) {

if (rowData) {

_rowIndex = rowIndex;

_Row = rowData;

}

}

});

//设置分页控件

var p = $('#CarType').datagrid('getPager');

$(p).pagination({

showPageList: false,

pageSize: 20, //每页显示的记录条数,1

beforePageText: '第', //页数文本框前显示的汉字

afterPageText: '页 共 {pages} 页',

displayMsg: '共 {total} 条记录',

onSelectPage: function (pageNumber, pageSize) {

_pageIndex = pageNumber;

GetCarTypes(pageNumber, pageSize);

$('#CarType').datagrid('options').pageNumber = _pageIndex;

}

});

}

function GetCarTypes(pageNumber, pageSize) {

var BiGuidedPrice = $("#BiGuidedPrice").val() == "" ? 0 : $("#BiGuidedPrice").val();

var EiGuidedPrice = $("#EiGuidedPrice").val() == "" ? 0 : $("#EiGuidedPrice").val();

AjaxCall("/BaseInfo/CarType/GetCarType", {

pageIndex: pageNumber, pageSize: pageSize,

sBrandName: $("#sBrandName").val(), sFirmName: $("#sFirmName").val(), sModelName: $("#sModelName").val(),

sDisplacementName: $("#sDisplacementName").val(), sTransmissionMmodelName: $("#sTransmissionMmodelName").val(),

BiGuidedPrice: BiGuidedPrice, EiGuidedPrice: EiGuidedPrice

},

function (res) {

$('#CarType').datagrid('loadData', { "total": res.total, "rows": res.rows });

});

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: