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 });
});
}
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 });
});
}
相关文章推荐
- UI_UIScrollView
- iOS UICollectionView
- UI06_无限滚动的相册
- UI06_UIScrollView
- UI05_手势
- UI05_Control
- UI04_delegate
- UI04_Target-Action
- CALayer的常用属性(笔记与分享)
- UI_Touch
- mapreduce中的sequenceFile类,MapFile解析
- UINavigationController (导航控制器)
- UIWindow & UIWindowLevel笔记
- 励精图治---Concurrency---GUI设计
- UItableView一些小方法
- poj3581 Sequence(后缀数组sa的运用+离散化)
- ThreadPoolExecutor使用和思考-线程池大小设置与BlockingQueue的三种实现区别
- Opencv3.0+opencv_contrib_lib +VS2013(编译)+CMake-gui(最近的版本都可以)
- 判断 Fragment 的 UI 是否可见
- UML建模之时序图(Sequence Diagram)