gpt4 book ai didi

javascript - 如何在 sencha 的网格中添加页脚

转载 作者:行者123 更新时间:2023-11-29 10:33:58 24 4
gpt4 key购买 nike

这是我作为 PurchaseReport.js 的 View 部分

Ext.define("App.view.tabs.PurchaseReport", {
extend: "Ext.panel.Panel",
alias: "widget.PurchaseReportTab",
requires: [
"App.model.PurchaseReport", "Ext.toolbar.Toolbar"
],
border: false,
layout: "fit",
items: [
App.Util.buildBrowseConfig({}, {
controller: "PurchaseReport",
primaryKeyField: "PurchaseReportId",
stateful: true,
stateId: "App.view.windows.PurchaseReport-grid",

columns: [
{ dataIndex: "PurchaseCost", filter: true, header: "Purchase Cost", width: 150 }
],
features: [{ ftype: "filters", autoReload: false, local: true }],
store: { model: "App.model.PurchaseReport", sorters: [{ property: "Name", direction: "asc" }] }
})
]

});

这是我的 Controller 部分,我的网格在其中绑定(bind)为 PurchaseReport.js,那么我需要在这里进行更改吗?

Ext.define("App.controller.tabs.PurchaseReport", {
extend: "Ext.ux.app.BrowseController",
views: ["tabs.PurchaseReport"],
refs: [
{
ref: "myPurchaseReportGrid",
selector: "PurchaseReportTab > gridpanel"
}
],

init: function () {
this.control({
PurchaseReportTab: {
bind: function (a, c) {
**//Grid bind start**
var b = this.getMyPurchaseReportGrid();
b.getSelectionModel().deselectAll();
b.store.removeAll();
b.fireEvent("bind", b, c)
**//Grid bind End**

**//Combobox Bind start**
var combo = this.getCoachCombo(),
store = combo.store,
options = store.lastOptions || {};
options = Ext.apply({
callback: function () {
combo.select(App.coach.CoachId)
//console.log("called rajesh");
}
}, options);
store.load(options);
if (App.coach.IsAdmin) {
combo.show()
}
**//Combobox Bind end**


var abilities = App.coach.Abilities,
toolbar = this.getToolbar();
for (var x = 0; x < abilities.length; x++) {

var ability = abilities[x],
button = toolbar.query("button[tooltip=" + ability.Name + "]");
if (button.length) {
button[0].setVisible(true)
}
}

}
},

"PurchaseReportTab > gridpanel": {
bind: this.bind,
itemdblclick: this.handleRecord,
selectionchange: this.selectionChange
}


})
}

});

这是我的模型部件名称 PurchaseReport.js

 Ext.define("App.model.PurchaseReport", {
extend: "Ext.data.Model",
fields: [
{
name: "PurchaseDate",
type: "date"
}
],

proxy: {
type: "ajax",
url: "ControllerFactory.aspx",
extraParams: {
controller: "PurchaseReport",
operation: "GetPurchaseReportsByCoachIdAndDates"
},
reader: {
type: "json",
root: "data",
successProperty: "success"
}
}

});

但是我能够在 GridView 中显示记录,但我需要一个页脚区域,我可以在其中显示采购成本总额。在网格的底部

请不要发现代码错误,因为我删除了很多东西以使其看起来更简单,因为我是新手,请告诉我需要哪些更多细节。

只是一个图像更多细节 enter image description here

我已经尝试添加代码,但它在 Gridview 显示记录的所有页面中显示页脚,我只想在一个页面而不是其他页面上显示页脚,并且还需要显示总购买成本那个

Ext.define("Ext.grid.Panel", {
extend: "Ext.panel.Table",
requires: ["Ext.grid.View"],
alias: ["widget.gridpanel", "widget.grid"],
alternateClassName: ["Ext.list.ListView", "Ext.ListView", "Ext.grid.GridPanel"],
viewType: "gridview",
lockable: false,
bothCfgCopy: ["invalidateScrollerOnRefresh", "hideHeaders", "enableColumnHide", "enableColumnMove", "enableColumnResize", "sortableColumns"],
normalCfgCopy: ["verticalScroller", "verticalScrollDock", "verticalScrollerType", "scroll"],
lockedCfgCopy: [],
rowLines: true,
//Newly addded start
height: 200,
width: 400,

bbar: [
{
xtype: 'textfield',
name: 'Total',
fieldLabel: 'Total',
allowBlank: false
}
],
renderTo: Ext.getBody()
//Newly addded end
});

最佳答案

要放置页脚,您需要在代码中使用 bbar。在您定义网格及其配置的代码中,您需要编写

示例:

 bbar: [
{
xtype: 'textfield',
name: 'Total',
fieldLabel: 'Total',
allowBlank: false
}
],

请阅读Documentation 为了更好地理解。我还为你做了一个 fiddle ,这样你就可以关联你的项目和网格。 Fiddle

关于javascript - 如何在 sencha 的网格中添加页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39849451/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com