PDA

View Full Version : x-form-clear-trigger Showing Dropdown Icon Instead of ClearTigger



rkanemeier
29 Mar 2012, 3:26 PM
Preface:

I apologize up front for anything dumb that might be in this post. I'm fairly new to ExtJS and tried searching Google and the forums for an answer.

I wrote some code in ExtJS 3.4 and brought it over to ExtJS 4. It seems my x-form-clear-trigger fields are now showing the tigger.gif (drop down combo box icon) instead of the clear-trigger.gif (button with an x in it). The following code snippet is from the tbar property of the columns config of an Ext.grid.GridPanel:




tbar: [{
text: 'Save',
disabled: true,
iconCls: 'save',
handler: function(btn) {
btn.disable();
Ext.each(updatedRecords, function(r) {
updateRec(r);
});
}
}
.....

{
xtype: 'tbtext',
text: 'Part:'
},{
xtype: 'trigger',
id: 'searchPart',
triggerClass: 'x-form-clear-trigger',
width: 75,
onTriggerClick: function(){
this.setValue('');
Ext.getCmp('gridParts').getBottomToolbar().changePage(1);
}
}


Again, I apologize if there is something amazingly stupid that I should have picked up on. Thanks in advance.

rkanemeier
30 Mar 2012, 5:08 AM
Well, I was able to change the icon by switching the property triggerClass to triggerCls. But now the ajax call to load my data store doesn't understand what searchPart is.



var dsParts = Ext.create('Ext.data.Store',{
model: 'part',
autoLoad : true,
proxy : {
type : 'ajax',
url : 'vvcall.pgm',
extraParams: {
pgm: 'RKGRIDEDT1',
action: 'loadGrid',
partsearch: searchPart
},
reader : {
type : 'json',
root : 'PSMMLPP',
totalProperty : 'totalCount'
}
},
listeners : {
load : function() {
gridParts.down('[text=Save]').disable();
updatedRecords = [];
}
}
});

...

{
xtype: 'tbtext',
text: 'Part:'
},{
xtype: 'trigger',
id: 'searchPart',
triggerCls: 'x-form-clear-trigger',
width: 75,
onTriggerClick: function(){
this.setValue('');
Ext.getCmp('gridParts').getBottomToolbar().changePage(1);
}
}




I'm using Chrome as my browser and here is what the console tells me:




Uncaught ReferenceError: searchPart is not defined

(anonymous function)
isEvent
b

skirtle
30 Mar 2012, 7:45 PM
You're attempting to use a variable called searchPart in your extraParams but it isn't declared anywhere, or at least nowhere that is in scope. This isn't really a problem with the AJAX request as such, any attempt to use the searchPart variable would have the same effect.