extjs4

ExtJS 4 instantiated model has id set to 0

佐手、 提交于 2019-12-10 12:14:52
问题 If I define an entity like this: Ext.define('MyApp.model.Entity', { extend : 'Ext.data.Model', fields : [ { name : 'id', type : 'int' } ] }); And then instantiate it and output its id with: var entity = Ext.create('MyApp.model.Entity'); console.log(entity.getId()); I'm getting 0 for the output. I would expect it to be undefined . Why is that? 回答1: There are two likely causes. First, because you're using the name id for a field. Ext.data.Model has the idProperty config which defaults to id ,

subarray models mapping issues with gridpanel extjs 4

人盡茶涼 提交于 2019-12-10 12:05:53
问题 stackoverflow team member I am having problem with displaying the json subarray data to my gridpanel my json data is below { "total": 11, "success": true, "employeetaskdetdata": [{ "subject": "Work in progress", "employee": { "username": "yogen", "designation": { "department": { "company": { "cmpname": "Kintu Designs Pvt ltd", "cmptitle": "Kintu Designs Pvt ltd", "cmpdesc": "<b>D-104 Toral Appartment Surat,<br>Timalyabad.</b>", "cmpfax": "8128812153", "cmpcontact": "8128812153", "cmpwebsite":

How to catch tree node clicks from a (MVC) controller in ExtJs 4?

若如初见. 提交于 2019-12-10 11:55:08
问题 In my ExtJS 4 controllers I can catch events on certain elements on the page. For example, to catche menu items clicks I can do: init: function() { this.control({ 'maintoolbar menuitem[action=contacts]': { click: function() { // do something ; } } })....... How do I do the same to catch tree node clicks? I pretty much want the same effect as the menu item (the tree has the id of settingstree). EDIT: here's the tree code: Ext.define('MyApp.view.system.SettingsTree',{ extend: 'Ext.tree.Panel',

values not correctly rendered in line chart in extjs?

£可爱£侵袭症+ 提交于 2019-12-10 11:36:40
问题 I'm having trouble with result rendered by line chart example from extjs4 the columns are rendered correctly but the line is not, notice in the picture how i need to have 4 while its drawed in the 0 xpoint also the second plot is supposed to be 5 when its draw in 2: here is my code: panel3 = Ext.create('widget.panel', { width: 600, height: 200, frame: false, renderTo: 'line', layout: 'fit', items: { xtype: 'chart', animate: false, store: storeline, insetPadding: 20, gradients: [{ angle: 90,

In ExtJs, how do I get an id after syncing a record to the store?

白昼怎懂夜的黑 提交于 2019-12-10 10:55:35
问题 If I have a store under ExtJs 4, how do I get an id from a newly added record after a sync occurs? For example, if I have a PersonStore set to autosync and I add a new person based on a form filled out by the users, I can add the new record to the store by doing the following; var values = button.up('form').getForm().getValues(), store = Ext.StoreMgr.lookup('PersonStore'), result; result = store.add(values); Since autosync is set to true, this sends over the new value to the backend where it

ExtJS findExact() and custom validator bug

蓝咒 提交于 2019-12-10 10:33:02
问题 I'm using a custom validator on my combobox's: function(v) { console.log(v === 'some value I know for SURE is in the store'); // (1) var index = this.getStore().findExact(this.displayField, v); return (index!==-1) ? true : 'Invalid selection'; } Basically admits the same set as forceSelection but allows the user to type arbitrary text to attempt to auto-complete. However; I'm having really odd results with findExact() . For example, if the combobox's value is currently valid , and a user does

how to scroll extjs 4 grid horizontally

好久不见. 提交于 2019-12-10 10:31:58
问题 What is the proper way to scroll a grid horizontally on load. I want to scroll to a particular grid column on load. I can focus the column I want using this: dataStore.on('load', function() { var cl = dataGrid.columns[43]; cl.focus(); }); but the grid does not scroll when I do this. 回答1: One possibility is to use scrollByDeltaX . Example: viewready: function(){ var c = this.columns[5]; var p = c.getPosition(); this.scrollByDeltaX(p[0]); } Working sample: http://jsfiddle.net/YRraU/2/ 来源: https

dynamic add items to border viewport

橙三吉。 提交于 2019-12-10 10:05:23
问题 I want to create a empty viewport(layout:border) first, then add items to it, finally render and show. but when I created the viewport element, it throw an error, says: Uncaught TypeError: Cannot read property 'flex' of undefined here are my code: <script type="text/javascript" src="ext-4.0.2a/bootstrap.js"></script> <script> Ext.require(['*']); Ext.onReady(function() { Ext.QuickTips.init(); var viewport = Ext.create('Ext.container.Viewport', { layout: 'border' }); var north = blablabla...

Dynamic Proxy URL for store.load() in MVC architecture with Ext JS

喜你入骨 提交于 2019-12-10 10:00:17
问题 I want to change the proxy of a store before (!) it is loaded. The specific problem in this case is that I do not find the right moment, when to load. In detail: I have created a MVC-model by creating a view, a controller, a model, and a store as defined by EXTJS4 architecture. The view is a grid panel. It defines the store within its own define statement: Ext.define('P.view.MyView' ,{ extend: 'Ext.grid.Panel', alias : 'widget.MyView', ... store: 'MyStore', ... } When I load the store with

How to add more than 3 SERIES in a LINE or SCATTER chart?

可紊 提交于 2019-12-10 09:43:40
问题 When I try to add more than 3 SERIES in a LINE or SCATTER chart, an exception occurs: In Google Chrome: Uncaught TypeError: Property 'undefined' of object [object Object] is not a function In Firefox: Ext.chart.Shape[type] is not a function [Stop this error] }, attr)); This was identified by ExtJS Support as a bug: http://www.sencha.com/forum/showthread.php?140932-How-to-add-more-than-3-SERIES-in-a-LINE-or-SCATTER-chart Below follow the code: Ext.require('Ext.chart.*'); Ext.define('AM.view