EXTJS5 Project in progress: Open a new panel and load the data (iii)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.