Results 1 to 2 of 2

Thread: Datastore to java variable

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Vote Rating

    Default Datastore to java variable

    I'm trying to place records from a datastore into a javascript variable on my page. I have it writing to a grid panel and the information is coming across so I know it's there, I just don't know how to access the datastore records individually. After that I need to and pass them back to my html page. I'm flying solo here at work, as extjs is completely new to me. I've looked through a good portion of the documentation on both datastores and gridpanels, as well as the forums, and I have read 2 schools of thought, 1 is that I should load the data from the model directly (which I'm not sure if that's possible considering the actual data is in the store) and 2 I should do it like I am doing it currently.

    The ajax request will always just pull back 1 record.

    var params = Ext.urlDecode(;
    var oms_premise = params.OMS_Premise
     Ext.define('Customer', {
         extend: '',
         fields: [
                {name: 'ACCOUNT_NUM'},
                { name: 'LOCATION' },
                { name: 'METER_NUM' },
                { name: 'NAME' },
                { name: 'PHONE' },
                { name: 'XFMR' }
     //GET DATA
     var myStore = Ext.create('', {
         model: 'Customer',
         proxy: {
             type: 'ajax',
             url: 'http://omsdev/omsportal/Application/Framework/getCustByOMSPremise.aspx?oms_premise=' + oms_premise,
                     root: 'Customer Info',
                     totalProperty: 'totalCount'
            autoLoad: true
        //LOAD DATA
        // DRAW GRID
        var grid;
        grid  = new Ext.grid.GridPanel({
            store: myStore,
            columns: [
                 { header: 'NAME', width: 150, dataIndex: 'NAME' },
                 { header: 'LOCATION', width: 300, dataIndex: 'LOCATION' },
                { header: 'METER_NUM', width: 100, dataIndex: 'METER_NUM' },
               { header: 'PHONE', width: 90, dataIndex: 'PHONE' },
                  { header: 'ACCOUNT_NUM', width: 150, dataIndex: 'ACCOUNT_NUM' }
    //            {header: 'OUTAGE MINUTES', width: 120, sortable: true, dataIndex: 'OUT_MINUTES'},
    //            {header: 'CDTS', width: 90, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s'), dataIndex: 'CDTS'},
    //            {header: 'OFFTIME', width: 90, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y H:i:s'), dataIndex: 'OFFTIME'},
    //            {header: 'CAUSE CODE', width: 150, sortable: true, dataIndex: 'CAUSE_CODE',renderer:causeDecode},
    //            {header: 'WEATHER CODE', width: 90, sortable: true, dataIndex: 'WEATHER_CODE'},
    //            {header: 'COMPLETION REMARKS', width: 200, sortable: true, dataIndex: 'COMPLETION_REMARKS'}
            renderTo: 'CustomerGrid'

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL
    Vote Rating


    You are letting the store load it so how you are doing it is fine.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts