1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    6
    Vote Rating
    1
    pawanyanky is on a distinguished road

      0  

    Default 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
    Attached Images
    Attached Files

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    872
    Answers
    3566
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    6
    Vote Rating
    1
    pawanyanky is on a distinguished road

      0  

    Default 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.

  4. #4
    Sencha User
    Join Date
    Jan 2013
    Posts
    6
    Vote Rating
    1
    pawanyanky is on a distinguished road

      0  

    Default


    please someone answer to my question, i am stuck here with above problem. please

Thread Participants: 1

Tags for this Thread