ext条件付きクエリーのページング
EXTについては特に深く研究されていないようですが...どこが欠けているのか分からないが、これは私が自分で勉強した言語で、なんだかコードの品質に問題があるような気がします.
みんなに送って見せてください.
ext検索条件付きクエリーおよびページング
みんなに送って見せてください.
ext検索条件付きクエリーおよびページング
function QueryString()
{
var name,value,i;
var str=location.href;
var num=str.indexOf("?")
str=str.substr(num+1);
var arrtmp=str.split("&");
for(i=0;i < arrtmp.length;i++){
num=arrtmp[i].indexOf("=");
if(num>0){
name=arrtmp[i].substring(0,num);
value=arrtmp[i].substr(num+1);
this[name]=value;
}
}
}
Ext.onReady(function(){
var fm = Ext.form;
var Request=new QueryString();
var ID="";//Request["wlid"];
//
var zlUrl=getRootPath()+'servlet/SearchGoods?change=searchallGoods';
var grid = null;
var page_size = 60;
var cm = new Ext.grid.ColumnModel({
defaults: {
sortable: true
},
columns: [ new Ext.grid.CheckboxSelectionModel(),
new Ext.grid.RowNumberer(),
{
header: ' ',
dataIndex: 'KHcode'
}, {
header: ' ',
dataIndex: 'goodsCode'
},{
header: ' ',
dataIndex: 'shortName'
}, {
header: ' ',
dataIndex: 'style'
}, {
header: ' ',
dataIndex: 'unitName'
}, {
header: ' ',
dataIndex: 'APPROVALNO'
}, {
header: ' ',
dataIndex: 'FACTORY'
}, {
header: ' ',
dataIndex: 'STCount'
}, {
header: ' ',
dataIndex: 'aprice'
}, {
id: 'description',
header: ' ',
dataIndex: 'PPRICE'
}, {
header: ' ',
dataIndex: 'SPRICE'
}, {
header: '',
dataIndex: 'unitId',
hidden:true,
hideable:false
}, {
header: '',
dataIndex: 'goodsId',
hidden:true,
hideable:false
}
]
});
var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: zlUrl
}),
reader: new Ext.data.JsonReader({
totalProperty: 'totalCount',
root: 'gridRows',
fields: [
{name:'KHcode'},
{name: 'goodsCode', mapping: 'goodsCode'},
{name: 'shortName'},
{name: 'style'},
{name:'unitName'},
{name: 'APPROVALNO'},
{name: 'FACTORY'},
{name:'STCount'},
{name: 'aprice'},
{name: 'PPRICE'},
{name: 'SPRICE'},
{name: 'unitId'},
{name: 'goodsId'}
]
})
});
//
var dsSupplier = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:getRootPath()+'servlet/SearchGoods?change=sgoodsType'
}),
reader: new Ext.data.JsonReader({
root: 'gridRows',
totalProperty: 'totalCount'
}, [
{name: 'typeName', mapping: 'typeName'},
{name: 'typeId', mapping: 'typeId'}
])
});
var typeid="";
var combo = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
selectOnFocus :true,
listClass: 'x-combo-list-small',
store:dsSupplier,
valueField:'typeId',
displayField:'typeName',
//editable: true,
listeners:{
select: function(){
Ext.get('typeId').dom.value=this.getValue();
store.load({
params:{
start : 0,
limit : page_size,
typeId:this.getValue()// ,
}
});
}
}
});
grid = new Ext.grid.EditorGridPanel({
autoScroll:true,
store: store,
sm : new Ext.grid.CheckboxSelectionModel(),
cm: cm,
renderTo: 'editor-grid',
width: Ext.get("content").getWidth(),
height: Ext.get("content").getHeight(),
autoExpandColumn: 'description', // column with this id will be expanded
title: ' ',
frame: true,
clicksToEdit: 1,
viewConfig:{
forceFit:true,//
autoFill:true,
sortAscText:' ',
sortDescText:' ',
columnsText:' '
},
tbar: [{
text: ' :'
},combo,'-',
{xtype:'textfield',
fieldLabel: ' ',
id: 'searchContent',
name: 'searchContent'
},'-',
{
text:' ',
handler:function(){
//Ext.get('searchContent').dom.value=Ext.getCmp('searchContent').getValue();
store.load({
params:{
start : 0,
limit : page_size,
storeId:Request["STOREID"],
wlid:Request["WLID"],
typeId:Ext.get('typeId').dom.value,
searchContent:Ext.getCmp('searchContent').getValue()
}
});
}
},
'-',{
text: ' ',
handler:function(){
var json = [];
var recordDtlArray = grid.getSelectionModel().getSelections();
for(i = 0; i<recordDtlArray.length;i++){
json.push(recordDtlArray[i].data);
}
if(json.length==0){
Ext.Msg.alert(' ',' ');
return;
}
//
Ext.lib.Ajax.request(
'POST',
getRootPath()+'servlet/SearchGoods?change=checkedGoods',
{
success:function(request){
var message = request.responseText;
window.returnValue=message;
window.close();
},
failure:function(){
Ext.Msg.alert(" ", " ");
}
},
'&members='+encodeURIComponent(Ext.encode(json))
);
}
}],
bbar:new Ext.PagingToolbar({
pageSize : page_size,
store : store,
displayInfo : true,
displayMsg: '',
emptyMsg: " ..",
beforePageText:' ',
afterPageText:' , {0} '
})
});
Ext.getCmp('searchContent').setValue(decodeURI(Request["codestr"]));
store.load({
params : {
typeId:Ext.get('typeId').dom.value,
searchContent:Ext.getCmp('searchContent').getValue(),
storeId:Request["STOREID"],
wlid:Request["WLID"],
start : 0,
limit : page_size
}
});
store.on('beforeload',function(){
Ext.apply(this.baseParams,{
typeId:Ext.get('typeId').dom.value,
storeId:Request["STOREID"],
wlid:Request["WLID"],
searchContent:Ext.getCmp('searchContent').getValue()
});
});
window.onresize = function(){
grid.setWidth(0);
grid.setHeight(0);
grid.setWidth(Ext.get("content").getWidth());
grid.setHeight(Ext.get("content").getHeight());
};
});