-
1 Feb 2013 5:02 AM #1
Unanswered: how to set data from server in one field & hard coded data in another field of store
Unanswered: how to set data from server in one field & hard coded data in another field of store
Hi I am developing a chart application in this data is coming from server for both xField and yField of series, but I wanted only yField`s( numeric value e.g. 10, 20, 30, 55, 88 for columns of chart ) data to come from server and make xField ( Jan, Feb, Mar, Apr....Dec ) data to make hard coded in Store. so that application works faster.
I have attached my code in main.txt below, this file has Model, Store, and View of application. and below is my application`s screen shot. on Click of "Change Year" button I am updating store,but I only want to update column field i.e fieldY , not fieldX rounded in red color below, I want fieldX to make hard coded in store. please help me.
chartApp.jpg
-
3 Feb 2013 1:39 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,656
- Vote Rating
- 435
- Answers
- 3108
If you want a field to have hard coded data that is not returned from the server, you could use the convert config in the field object.
Code:fields : [ { name : 'foo', convert : function(value, record) { return 'bar'; } } ]Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
3 Feb 2013 11:07 PM #3
all columns of chart is not being drawn, only one column is being drawn.
all columns of chart is not being drawn, only one column is being drawn.
Hi, below is my code for Model and Store , I did as you said but my chart is showing only one column instead of multiple column .
Ext.define("triumphsys/mobility/revenueAnalyzer.model.User", {
extend: "Ext.data.Model",config: {/*fields:[{name: "name", type: "string"},{name: "comedy", type: "float"}]*/fields :[{ name : 'name', convert : function(value, record){var data = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];return data;
}},{name: "comedy", type: "float"}]}});var store = Ext.create("Ext.data.Store", {model: "triumphsys/mobility/revenueAnalyzer.model.User",requires: ['Ext.data.Store','Ext.data.proxy.JsonP'],autoLoad: true,proxy: {type: "jsonp",url : "localhost/mobileApp/sencha-touch/php/getDataForChartDemoMvcViaJsonPFast.php",callbackKey: 'callback',reader:{type: "json",rootProperty: "data"},success: function(result, request){Ext.Msg.alert(result);console.log(result);
},extraParams: {Year : '2012'}}});
please guide me to solve the issue.
-
5 Feb 2013 1:05 AM #4
please someone answer to my question, i am stuck here with above problem. please


Reply With Quote