View Full Version : How to use an 'enforceMaxLength' at 'tagfield'

17 Apr 2020, 8:32 AM
Hello everybody.
I tried to limit the length of the string in tagfield. As was written in the manual, you need to use 'maxLength' and 'enforceMaxLength'. But that did not work.

https://fiddle.sencha.com/#view/editor&fiddle/35ad (https://fiddle.sencha.com/#view/editor&fiddle/35ad)

name : 'Fiddle',

launch : function() {
var shows = Ext.create('Ext.data.Store', {
fields: ['id','show'],
data: [
{id: 0, show: 'Short tag'},
{id: 1, show: 'Short tag'},
{id: 3, show: 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'}

Ext.create('Ext.window.Window', {
//renderTo: Ext.getBody(),
title: 'Tagfield Test',
height: 200,
width: 500,
layout: 'fit',
items: [{
xtype: 'tagfield',
maxLength: '10',
enforceMaxLength: true,
fieldLabel: 'Pick a tag',
store: shows,
displayField: 'show',
valueField: 'id',
queryMode: 'local',
filterPickList: true,
minWidth: 300,
maxWidth: 200,
maxHeight: 10