extjs4.1

How I'll create a model from json file? (ExtJS)

ⅰ亾dé卋堺 提交于 2019-12-12 16:06:57
问题 This the model that I want to create using json file Ext.define('Users', { extend: 'Ext.data.Model', fields: [{name: 'user_id', type: 'int'}, {name: 'user_name', type: 'string'}] }); What do I have to do in order to automatically create this model, based on the content of a json response from the server? 回答1: In order to have the model created automatically, you need to include the metaData field with your Json data. metaData can be used to describe all of the fields for the Model. In the

Downloading multiple files into a Zip file Javascript using data URI

拥有回忆 提交于 2019-12-12 11:34:42
问题 I am using EXT JS 4.2 which has a panel which contains a export to CSV button. On clicking on it multiple (total six) files are downloaded. I want these files to be downloaded in a single ZIP file. 回答1: There is a perfect plugin to create zip files inside browser. JSZip: https://stuk.github.io/jszip/ Install the plugin by adding js files manually: download JSZip and include the file dist/jszip.js or dist/jszip.min.js JSFiddle - JSZip 3.0: https://jsfiddle.net/andrebonna/u8zsbzau/ var zip =

Selectively aborting an ajax request sent via Extjs Direct proxy

隐身守侯 提交于 2019-12-12 10:04:00
问题 I have a store which is loaded w.r.t items from a list using Extjs direct proxy. proxy : { type: 'direct', api: { read: bomManagementAction.bomQuickDetails } } and the response is displayed in a grid panel. If larger number of items are selected, it will take long time to complete , so if a longer request is pending and if we sent a short request , definitely the grid will be updated with the latter one , but what happens is when the former request completes then the grid will re update with

ExtJs grid.Panel store: keep scrollbar position after load/reload

房东的猫 提交于 2019-12-12 09:30:00
问题 I'm using grid.Panel in Sencha ExtJs 4.0.2a and I reload a Json Store every 60 seconds. I was wondering if there is a way to preserve the position of the scrollbar after a data load. So that the user can continue to look at the records he was looking before the load.. I reload the data in the grid using a Task: var task = { run: function(){ Ext.getCmp(panelGridId).getStore().load({ //Callback function after loaded records callback: function(records) { //Hide grid if empty records if (Ext

ExtJS Grid SelectionChange is fired in other controller

最后都变了- 提交于 2019-12-12 06:26:33
问题 I have a main application with a left navigation menu. My Main.js controller handles the treepanelselect event where a Tab is added: onTreepanelSelect: function (selModel, record, index, options) { var mainPanel = Ext.ComponentQuery.query('mainpanel')[0]; var newTab = mainPanel.items.findBy( function (tab) { return tab.title === record.raw.text; }); if (!newTab) { newTab = mainPanel.add({ xtype: record.raw.class_name, // this is my View widget name closable: true, iconCls: "key", title:

change the html from controller in extjs

孤人 提交于 2019-12-12 06:25:59
问题 In my Extjs 4.1.1a project, Fiddle ( this fiddle is not working, it is just for reference ) I am changing the HTML(In controller) value using Ext.apply(weekNotifications,{html: {"hello"}); But the page(view) is not updating. When I checked the variable weekNotifications in Chrome console, after the above function, the innerHTML is "hello" as I added but in weekNotifications.el.dom.innerHTML is "Notifications here" (old text). I even tried: weekNotifications.update("Hello"); //same problem as

ExtJS - Adding headers to AJAX store

一笑奈何 提交于 2019-12-12 05:38:48
问题 Despite that I have configured the headers configuration of my store, getting an error like this: No 'Access-Control-Allow-Origin' header is present on the requested resource . Here is my proxy configuration of Ext.data.Store : proxy : { type : 'ajax', headers : { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'POST, GET, OPTIONS, DELETE, PUT', 'Access-Control-Max-Age': '1000', 'Access-Control-Allow-Headers': 'x-requested-with, Content-Type, origin, authorization, accept,

ExtJS Auto Resize Tab Panel

老子叫甜甜 提交于 2019-12-12 04:10:06
问题 We have a viewport, and inside it we have a west region for navigation tree and a center region for content (grids, forms, etc.) which has a tab panel inside it. We dynamically add content (tabs) to this tab panel, on click of any sub-menu item in navigation tree . These tabs are not re-sized on window re-size. The function to add tabs dynamically is: function AddNewTab(title, url, closable) { var tabs = Ext.getCmp('tabs'); tabs.add({ xtype: 'panel', title: title, closable: closable,

How to modify fields before rendering it to the grid in Extjs

隐身守侯 提交于 2019-12-12 04:07:26
问题 I have to append a value to the data fetched from the store before rendering it to the grid in ExtJs. Please guide me on achieving the above mentioned functionality. Currently the grid is populated in the following manner: Ext.define("MyApp.view.ShowDetails",{ extend: 'Ext.grid.Panel', requires:['MyApp.store.MyStore'], store:'MyStore', stateId: 'stateGrid', selType : 'checkboxmodel', selModel : { mode : 'MULTI' }, plugins : [Ext.create('Ext.grid.plugin.RowEditing', { clicksToEdit : 2 })],

How to refer the store in Controller --> Code.js file?

╄→гoц情女王★ 提交于 2019-12-12 03:29:12
问题 I am storing the JSON format in to Code.js of store folder. 'store' folder --> Code.js Ext.define('LoginPage.store.Code', { extend: 'Ext.data.Store', model: 'LoginPage.model.Code', autoLoad: true, proxy: { type: 'ajax', api: { read: 'data/loginResponse.json', update: 'data/checkCredentials.json' //contains: {"success": true} }, reader: { type: 'json', root: 'login', successProperty: 'success' } } }); 'model' folder --> Code.js Ext.define('LoginPage.model.Code', { extend: 'Ext.data.Model',