PDA

View Full Version : [INFOREQ]Ext.form.field.Trigger: possible bug in markInvalid()



daniel-braga
19 May 2011, 2:42 PM
i'm trying extends Ext.form.field.Trigger, but i think i've found a bug in validation. If i set allowBlank:false, after clicking in clear trigger, validation will mark the field as invalid and the trigger wrap element will be resized to 17px. When i set display:block on clear trigger the wrap is not resized.

26153

26154

26155

evant
19 May 2011, 9:51 PM
It's not really possible to say. Please post a test case.

daniel-braga
20 May 2011, 4:38 AM
1 - Edit "examples/form/custom-form.js" and set allowBlank: false to searchfield.



Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '../ux');
Ext.require([
'Ext.data.*',
'Ext.panel.Panel',
'Ext.view.View',
'Ext.layout.container.Fit',
'Ext.toolbar.Paging',
'Ext.ux.form.SearchField'
]);

Ext.define('Post', {
extend: 'Ext.data.Model',
idProperty: 'post_id',
fields: [
{name: 'postId', mapping: 'post_id'},
{name: 'title', mapping: 'topic_title'},
{name: 'topicId', mapping: 'topic_id'},
{name: 'author', mapping: 'author'},
{name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
{name: 'excerpt', mapping: 'post_text'}
]
});

Ext.onReady(function(){

var forumId = 4;

var store = Ext.create('Ext.data.Store', {
model: 'Post',
proxy: {
type: 'jsonp',
url: 'http://sencha.com/forum/topics-remote.php',
extraParams: {
forumId: forumId
},
reader: {
type: 'json',
root: 'topics',
totalProperty: 'totalCount'
}
},
listeners: {
beforeload: function(){
var params = store.getProxy().extraParams;
if (params.query) {
delete params.forumId;
} else {
params.forumId = forumId;
}
}
}
});
store.loadPage(1);

var resultTpl = Ext.create('Ext.XTemplate',
'<tpl for=".">',
'<div class="search-item">',
'<h3><span>{lastPost:this.formatDate}<br />by {author}</span>',
'<a href="http://sencha.com/forum/showthread.php?t={topicId}&p={postId}" target="_blank">{title}</a></h3>',
'<p>{excerpt}</p>',
'</div></tpl>',
{
formatDate: function(value){
return Ext.Date.format(value, 'M j, Y');
}
});

var panel = Ext.create('Ext.panel.Panel', {
title: 'Forum Search',
height: 300,
width: 600,
renderTo: 'search-panel',
id: 'search-results',
layout: 'fit',
items: {
autoScroll: true,
xtype: 'dataview',
tpl: resultTpl,
store: store,
itemSelector: 'div.search-item'
},
dockedItems: [{
dock: 'top',
xtype: 'toolbar',
items: {
width: 400,
fieldLabel: 'Search',
labelWidth: 50,
xtype: 'searchfield',
allowBlank: false, // <= I changed here
store: store
}
}, {
dock: 'bottom',
xtype: 'pagingtoolbar',
store: store,
pageSize: 25,
displayInfo: true,
displayMsg: 'Topics {0} - {1} of {2}',
emptyMsg: 'No topics to display'
}]
});
});

2 - Open "examples/form/custom-form.html" in your browser.

3 - Perform a search.

4 - Click on "clear" trigger.

5 - Perform a new search.

Expected:
26172

Obtained:
26173

daniel-braga
5 Jun 2011, 5:38 AM
It's not really possible to say. Please post a test case.

I posted a test case. Is there any solution?