hibernate3-SpringMVC+hibernate4+Extjs4.2+mysql

WBOY
發布: 2016-06-06 09:45:03
原創
1387 人瀏覽過

mysqlhibernate3springmvcextjs4 2


  1. 后台处理数据库数据(读取数据)
    @RequestMapping("/getmanagers")@ResponseBodypublic Map getWorkOrders(String page,String limit,String start,String all){ int pageInt = Integer.parseInt(page); int limitInt = Integer.parseInt(limit); int startInt = Integer.parseInt(start); Map map = new HashMap(); List list = workOrdersService.getWorkOrders(); List listTemp ; //数据库中的结果条数小于分页限制,则直接返回结果 map.put("total",list.size()); if(list.size()=list.size()){ listTemp = list.subList(startInt, list.size()); }else{ listTemp = list.subList(startInt, pageInt*limitInt); } map.put("workOrders", listTemp); return map;}

  1. ExtMVC

中的model
Ext.define('tw.model.GlobalStatisticsModel',{
extend : 'Ext.data.Model',
fields: [
{name: 'id', type: 'int',sortType :'aesc'},
{name: 'failuretime',type: 'date'},
{name: 'failureaddress', type: 'string'},
{name: 'repairtime', type: 'string'},
{name: 'maintenanceman', type: 'string'},
{name: 'completion', type: 'string'},
{name: 'failurecontent', type: 'string'}
]
});
中的store
Ext.define('tw.store.GlobalStatisticsStore',{
extend:'Ext.data.Store',
model:'tw.model.GlobalStatisticsModel',
pageSize: 17,
proxy:{
type:'ajax',
url: 'gdgl/getmanagers',
reader: {
type: 'json',
root: 'workOrders'
},
writer:{
type: 'json'
}
},
autoLoad: true
});
然后是Ext的View
Ext.define('tw.view.gdgl.GlobalStatisticsView',{
extend : 'Ext.grid.Panel',
xtype : 'globalStatisticsView',
store:'GlobalStatisticsStore',
selType : 'checkboxmodel',
forceFit:false,
columns: [{
text: 'ID',
dataIndex: 'id',
width:50,
editor: {
readOnly:true
}
}, {
// text: '故障时间',
header:'故障时间',
dataIndex: 'failuretime',
width:180,
renderer : Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
editor: {
allowBlank: false
}
}, {
text: '故障地点',
dataIndex: 'failureaddress',
width:200,
editor: {
allowBlank: false
}

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!