Nonsense not much to say, on the code:
Application structure:
View Code:
Ext.define (' Lz.view.Systems.PageManagerView ', {
Extend: ' Ext.grid.Panel ',
Xtype: ' PageView ',
Store: ' Systems.pagestore ',
closable:true,//Close button in upper right corner
Closeaction: ' Destroy ',//Destroy the cache after shutdown
forcefit:true,//Self-adapting
Tbar: [
{text: ' New ', Action: ' Add '},
{text: ' Modify ', Action: ' Modify '},
{text: ' delete ', action: ' Delete '},
' and ',
{
Xtype: ' TextField ',
Fieldlabel: ' Menu name ',
LabelAlign: ' Right ',
ID: ' txtID '
}, {
Xtype: ' button ',
Text: ' Query ',
Action: ' Seatch '
}],
Columns: [
{xtype: ' Rownumberer '},
{text: ' Menu name ', dataindex: ' Page_name '},
{text: ' URL ', dataindex: ' Page_url '},
{text: ' sort ', dataindex: ' Order '},
{
Text: ' Status ', Dataindex: ' State ', renderer:function (value) {
if (value = = 0) {
return ' Enable ';
} else {
return ' deactivate ';
}
}
},
{text: ' Remarks ', dataindex: ' Note '}
],
Dockeditems: [{
Xtype: ' Pagingtoolbar ',
Store: ' Systems.pagestore ',
Dock: ' Bottom ',
displayinfo:true,//Display summary data in the lower right corner
Displaymsg: ' Show {0}-{1} records, total {2} records ',
Emptymsg: ' No record '
}],
Initcomponent:function () {
This.callparent (arguments);
This.store.load ();
}
});
Store Code:
Ext.define (' Lz.store.Systems.PageStore ', {
Extend: ' Ext.data.Store ',
Model: ' Lz.model.Systems.lg_sys_page_info ',
StoreId: ' Pagestores ',
PAGESIZE:20,
Proxy: {
Type: ' Ajax ',
URL: '/webservice/systems/systempageinfo.asmx/getpageinfoforid ',
ActionMethods:Ext.apply ({}, {"read": "POST"}, Ext.data.proxy.Ajax.prototype.actionMethods),
Reader: {
Type: ' JSON ',
Rootproperty: ' Rows ',//Note that this is root in version 4.2
Totalproperty: ' Total '
}
},
Autoload:false
});
Model Code:
Ext.define (' Lz.model.Systems.lg_sys_page_info ', {
Extend: ' Ext.data.Model ',
Fields: [
{name: ' page_id ', type: ' String '},
{name: ' Page_name ', type: ' String '},
{name: ' Page_url ', type: ' String '},
{name: ' Order ', type: ' Integer '},
{name: ' state ', type: ' Integer '},
{name: ' Note ', type: ' String '}
]
});
Controller code:
Ext.define (' Lz.controller.Systems.pageController ', {
Extend: ' Ext.app.Controller ',
Views: [' Systems.pagemanagerview ', ' viewform.pageform '],
Stores: [' Systems.pagestore '],
Models: [' Systems.lg_sys_page_info '],
Init:function () {
This.control ({
' pageview> toolbar Button[action=add] ': {
Click:function () {
Ext.Loader.setConfig ({
Enabled:true
});
var form = new Lz.view.Viewform.Pageform ();
Openwindow (form,400,250, ' add menu ');
}
}
});
}
});
Open page Code:
var Niwar = new Object ();
Niwar.openwindow = function (Wintitle, item, winwidth, Winbutton, config) {
Ext.create (' Ext.window.Window ', {
Autoshow:true,
Closable:true,
Modal:true,
Resizable:false,
Title:wintitle,
Buttons:winbutton,
Width:winwidth | | 280,
Items:typeof (item) = = ' String '? Ext.create (item, config): item
});
}
EXTJS5 Project in progress: Open a new panel and load the data (iii)