Forms 发送两次ExtJS表单
我有一个带有如下搜索(筛选)字段的表单:Forms 发送两次ExtJS表单,forms,extjs,filter,extjs4,request,Forms,Extjs,Filter,Extjs4,Request,我有一个带有如下搜索(筛选)字段的表单: xtype: 'form', id: 'searchPanel', title: 'Search', collapsible: true, bodyPadding: 10, height: 210, buttonAlign: 'left', defaults: { width: 400, labelWidth: 120, allowBlank: true, enableKeyEvents: true },
xtype: 'form',
id: 'searchPanel',
title: 'Search',
collapsible: true,
bodyPadding: 10,
height: 210,
buttonAlign: 'left',
defaults: {
width: 400,
labelWidth: 120,
allowBlank: true,
enableKeyEvents: true
},
layout: {
type: 'table',
columns: 2
},
items: [
{
xtype: 'textfield',
name: 'txtFltrSiteName',
fieldLabel: 'Site name or alias',
id: 'txtFltrSiteName'
},
{
xtype: 'textfield',
name: 'txtMonthTraffic',
fieldLabel: 'Month traffic',
id: 'txtMonthTraffic',
style: 'margin-left: 100px;'
},
{
xtype: 'combo',
id: 'ddlFltrPM',
name: 'ddlFltrPM',
fieldLabel: 'Project manager',
displayField: 'display_name',
valueField: 'user_id',
editable: false,
store: new storeOfUsers({ filters: [{ property: 'user_group_code', value: 'projectmanager', exactMatch: true }] })
},
// and many other fields below
但是当我点击
search
按钮时,我有两个post请求。一个是带过滤器的,第二个是不带过滤器的
send
按钮操作的我的代码:
p.S.
当我在
search
按钮处理程序函数中覆盖此行时:filters.push({dataIndex:'project\u manager\u id',type:'string',value:pm})代码>
每件事都是正常的,并且只有一个请求,所以问题可能就在这里。但我被困住了,不知道为什么会这样
谢谢你的帮助,
斯坦尼斯拉夫
UPD*
var filters = {
ftype: 'filters',
// encode and local configuration options defined previously for easier reuse
encode: true, // json encode the filter query
local: false,
filters: [{
type: 'string',
dataIndex: 'site_name'
}, {
type: 'date',
dataIndex: 'startdate'
}, {
type: 'string',
dataIndex: 'project_name'
// more fields below
试着跟随
if(filters.length > 0)
listOfSites.filters.addFilters(filters);
else
listOfSites.store.load();
addFilters()
可能已经调用了sync()
哦!谢谢,它能用!:)但是现在。。过滤器为空(在post
数据中没有“filter”字段)。@StasGrin请稍候,过滤器是什么?我以为是商店?你能发布它吗?我说的是通过点击“搜索”按钮将数据发送到我的脚本。这是我发布的字段过滤器的数据:“[{”type:“numeric”,“comparison:“eq”,“value”:2,“field:“project\u manager\u id”},{”type:“string”,“value:“2”,“field:“client\u id”}]”
我浏览了一个JS文件。“listofsites”对象中没有“filters”的声明。“但我想这是商店。”斯塔斯格林说。那么您已经实现了自定义filtertype了吗?据我所知,ExtJS只支持remoteSort的属性
+值
…您可以标记您的ExtJS版本吗?版本是:Ext JS 4
if(filters.length > 0)
listOfSites.filters.addFilters(filters);
else
listOfSites.store.load();