extjs4

ExtJs simulate TAB on ENTER keypress

一笑奈何 提交于 2019-12-10 16:13:30
问题 I know it is not the smartest idea, but I still have to do it. Our users want to use ENTER like TAB. So, the best I came up with is this: Ext.override(Ext.form.field.Base, { initComponent: function() { this.callParent(arguments); this.on('afterrender', function() { var me=this; this.getEl().on('keypress',function (e){ if(e.getKey() == 13) { me.nextNode().focus(); } }); }); } }); But it still does not work exactly the same way as TAB. I mean, it works OK with input fields, but not other

Ext.JS Prevent Proxy from sending extra fields

房东的猫 提交于 2019-12-10 16:13:14
问题 Here is my model: Ext.define('A.model.Group', { extend: 'Ext.data.Model', fields:['id', 'name'], proxy: { type: 'rest', url: '/group', reader: { type: 'json', root: 'data' }, writer: { type: 'json', writeAllFields: false } } }); The model is being used in a Tree via a TreeStore The problem is that when a PUT , POST or DELETE method is done, instead of sending only fields from the model in the JSON payload, fields from Ext.data.NodeInterface are also sent. Here is an example payload: {"id":"",

Set focus for text input in just created window

╄→尐↘猪︶ㄣ 提交于 2019-12-10 16:12:53
问题 I have trivial window: this.window = Ext.widget('window', { title: 'Find', closeAction: 'hide', width: 300, layout: 'fit', items: form }); with trivial form in it var form = Ext.widget('form', { layout: { type: 'vbox', align: 'stretch' }, border: false, bodyPadding: 10, items: [ this.findInput, ] }); which only has one item this.findInput = Ext.widget('textfield', { name: 'find' }); The issue is: how to set focus right after window is shown? I tried to call .focus() method of this.findInput

ExtJS 4 associations and store.save()

ⅰ亾dé卋堺 提交于 2019-12-10 15:42:56
问题 I am using ExtJS 4, and have a model with an association hasMany defined. ModelA -> hasMany -> ModelB I use GridA to show the data from ModelA. On clicking a record in GridA, I use a rowSelect event to create GridB which use ModelA.ModelB() as a store. It all goes well until I change a record in ModelB. The record does get updated in the hierarchy, but when I execute StoreA.save(), no change is sent back to the server. It does not notice the changes in associations. How do I save this data,

How to Dynamically Change the getRowClass function on an ExtJS GridPanel viewconfig After Render

岁酱吖の 提交于 2019-12-10 15:12:10
问题 I have an Ext.grid.Panel with a function that returns a custom class that is used to color code rows in the grid by overriding the getRowClass function. This works great, but I would like to give the user the option to change the criteria by which the grid is colored. The below example, I am coloring by the "severity" attribute, but I would like to change that to "status", for example. Is there a way I can dynamically change the getRowClass function, or maybe the entire viewconfig on the grid

Send all records of a Extjs store to server at once

喜你入骨 提交于 2019-12-10 14:56:22
问题 How can I send my entire store data to the server in one POST call? It could be in json format. thanks. Update: this is my store code: Ext.define('App.store.consultorio.Receita', { extend: 'Ext.data.Store', model: 'App.model.consultorio.Receita', autoLoad: false, proxy: { type: 'rest', reader: { type: 'json' }, writer: { type: 'json' }, url: 'consultas/receita.json' } }); 回答1: You could set every record in the store dirty, then call sync() store.each(function(record){ record.setDirty(); });

ExtJS 4 > Row Editor Grid > How to Change “Update” Button Text

假装没事ソ 提交于 2019-12-10 14:48:48
问题 Is there any way to change the text of "Update" button in ExtJS-4 Row Editor Grid ? 回答1: Good question, I had a look through the source code and whilst there is nothing inside the RowEditing plugin, in the class it extends 'RowEditor.js' there is the following: Ext.define('Ext.grid.RowEditor', { extend: 'Ext.form.Panel', requires: [ 'Ext.tip.ToolTip', 'Ext.util.HashMap', 'Ext.util.KeyNav' ], saveBtnText : 'Update', cancelBtnText: 'Cancel', ... }); So I'd assume you'd just need to override the

How to apply background color (or custom css class) to column in grid - ExtJs 4?

 ̄綄美尐妖づ 提交于 2019-12-10 14:19:53
问题 It seems like it should be so simple, but I simply cannot get this done (I don't even need it done dynamically). For example, suppose I have a simple 2 column grid setup like so: columns : [ {header: 'USER', dataIndex: 'firstName', width:70, cls: 'red'}, {header: 'CATEGORY', dataIndex: 'category', width:100} ] The cls: 'red' attribute only effects the header and not the actual column. I have seen elsewhere that I should be using a custom renderer (maybe), but if I try something like: {header:

change the background color of panels in extjs

大城市里の小女人 提交于 2019-12-10 12:20:03
问题 In my project, I am trying to change the background color of all the panels inside a container. The code which I am trying is as follows: container --> panel (don't change) --> panel (Change) //Generated dynamically using for loop. listeners: { 'render': function(panel) { panel.body.on('click', function() { //here change the background color of all the panels inside the container>panel. }); } } What should I write to change the background color of the only panels which are present inside the

Difference between Class.override() vs Ext.define('Class', override: 'Class' … to create an override [duplicate]

筅森魡賤 提交于 2019-12-10 12:19:47
问题 This question already has answers here : Best practice for overriding classes / properties in ExtJS? (2 answers) Closed 4 years ago . What's the difference between these 2 override So option 1: Ext.window.Window.override({ initComponent: function () { this.draggable = false; this.resizable = false; this.on('resize', function () { this.center(); }); this.callParent(); } }); option 2: Ext.define('Ext.window.WindowOverride', { override: 'Ext.window.Window', initComponent: function () { this