如何将 id 属性添加到 div-EXTJS3

How to add id attribute to a div-EXTJS3

我有一个组件 'id' 是自动生成的。出于样式目的,我想用我自己的 ID 替换该 ID。我无法使用 class 进行样式设置,因为 class 被许多其他组件使用。

Ext.query('.q-superdate-field')

结果为:

<input type="text" size="16" autocomplete="off" id="ext-comp-1100" name="ext-comp-1100" class="x-form-text x-form-field q-superdate-field x-form-empty-field x-trigger-noedit" readonly="" style="width: 100px;">

我想使用 id 更改输入字段的宽度。有没有办法替换现有的 'Id' 并创建我们自己的

动态更改id

Ext.select('.q-superdate-field').elements[0].id = 'newId';

注意:这不是最好的方法,我的回答只是针对你的问题。