• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[SOLVED] How do I reload(Call RPG from EXT js) after selecting a value from Combo

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] How do I reload(Call RPG from EXT js) after selecting a value from Combo

    Helle Everyone

    I am new to Valence and just created a DAshboard which has 3 panels

    Initialy when it's loaded I get the data from my rpg program
    It's loading a specific record set by default if parameter is blank

    Once I select a value on drop down I would like to reload with new values from database matching this selection

    How do I do that
    Here is a portion of my current ext js code
    Thanks in advance.

    Ext.onReady(function() {

    // The data store containing the list of entities
    var ent_list = Ext.create('Ext.data.Store', {
    fields: ['abbr', 'name'],
    data : [
    {"abbr":"TCNY ", "name":"NY Billing"},
    {"abbr":"T911", "name":"NY 911/EMS"},
    {"abbr":"TCMD", "name":"Maryland"},
    {"abbr":"TCPA", "name":"Pittsburg"},
    {"abbr":"TCML", "name":"Paoli"},
    {"abbr":"LUT ", "name":"B/A Lutheran"},
    {"abbr":"RID ", "name":"B/A Riddle"}

    ]
    });


    // });
    var tool_bar = Ext.create('Ext.toolbar.Toolbar', {
    //renderTo: document.body,
    width : 1350,
    title : 'Transcare Dashboard',
    items: [
    {
    text: 'Transcare Daily Dashboard -----> '
    },
    {
    xtype: 'combo',
    store: ent_list,
    displayField: 'name',
    typeAhead: true,
    mode: 'local',
    triggerAction: 'all',
    emptyText: 'Select Entity',
    name: 'EntList',
    itemid: 'EntList',
    selectOnFocus: true,
    width: 135,
    listeners : {
    scope : this,
    select : function(cmp, recs){
    var entity = recs[0].get('abbr');
    }
    }

    }

    ]
    });



    // Define a model for EPCR Status panel
    Ext.define('epcr_m', {
    extend: 'Ext.data.Model',
    fields: ['CATEGORY', 'TCALLORIG', 'TCALLPREB','TQAPROCES', 'TCLMSXFER', 'TCLMSHOLD']
    });
    // Define data store items for EPCR Status Panel
    var dsCustomers = new Ext.data.Store({
    model : 'epcr_m',
    autoLoad : true,

    proxy : {
    type : 'ajax',
    url : 'vvcall.pgm',
    extraParams: {
    pgm: 'CLMSDASH2',
    action: 'getEPCRSts',
    field: 'entity'

    },
    reader : {
    type : 'json',
    root : 'EPCRSTATUS'



    }
    },

    listeners : {
    beforeload : function() {
    this.getProxy().extraParams.entity = comboWindow.down('#EntList').getValue();
    }
    }
    });


    Look like my program is not being called

  • #2
    Use the select or change listener, get the value you need, and then get the other combos store, and load with the parameter included:

    otherStore.load({
    params : {
    TEMP : "FRIGID"
    }
    });

    Comment


    • #3
      Thanks

      Sorry I am just starting to learn Ext Js(I am an RPG programmer)

      How would I change my dsCustomers store to add parameter(entity) for example.
      How would I derive the value that was selected on the dop down and where do I place listeners
      I need to get the value of 'abbr' field and pass it to CLMSDASH2 rpg program
      Thanks

      Comment


      • #4
        You were close. You have the select listener on your first combo:

        Code:
        listeners : {
          scope : this,
          select : function(cmp, recs){
            var entity = recs[0].get('abbr');
        
            //remove the beforeload listener from your store and use this code or just do a dsCustomers.load();
            dsCustomers.load({
              params : {
                entity : entity
              }
          }
        }

        If this isn't working, see if you have any errors in the console or let me know what the response is.

        Comment


        • #5
          Thanks

          I will try this

          Comment


          • #6
            I entered the following into my dsCustomers store
            and getting a syntax error: missing after property

            listeners : {
            dsCustomers.load({
            params : {
            entity : entity
            }
            }
            )
            }

            Comment


            • #7
              A missing semicolon perhaps after your closing parenthesis?

              Comment


              • #8
                Sorry for late response I had to work on something else

                No it still gives me the same error
                here is my code again

                listeners : {
                dsCustomers.load({
                params : {
                entity : entity
                }
                }
                )
                }



                Does it have to be a part of Listener block?

                Comment


                • #9
                  What is the error? You are still missing a semicolon after your load function.

                  Comment


                  • #10
                    This is how it looks
                    listeners : {
                    dsCustomers.load({
                    Params : {
                    entity : entity
                    }
                    });
                    }

                    The error--- missing: after property
                    Not sure I tried to place ; after after each ending } or ) in that Listener block

                    Comment


                    • #11
                      Ahh, I see it now.


                      In this example, My listeners object has an property of 'select' which is the function that is fired off when the select event occurs. Within this function is the call to load the customers store.

                      Code:
                      listeners : {
                        scope : this,
                        select : function(cmp, recs){
                          var entity = recs[0].get('abbr');
                      
                          //remove the beforeload listener from your store and use this code or just do a dsCustomers.load();
                          dsCustomers.load({
                            params : {
                              entity : entity
                            }
                        }
                      }

                      Comment


                      • #12
                        So you know what the problem is?

                        Comment


                        • #13
                          Listeners config is an object, the object has properties and 'values' in this case, the listeners object should have an item for scope, and an item for the listener you want, "select".

                          You just have a function in the listener object so the javascript syntax is wrong.

                          Look at the previous code example I posted and see that my listeners object has properties, scope and select. The value for scope is the keyword 'this' and the value for select is a function. Within my function is the code I want to execute which loads the store.

                          Comment


                          • #14
                            Well here is what I entered into Listener block for the dsCustomers store
                            This time there were no syntax errors but , it's not loading the data after I select a value from Drop down
                            Do I need also to enter parameter named entity on the extraParams list of the Proxy: block?


                            listeners : {
                            scope: this,
                            select: function(cmp, recs){
                            var entity = recs[0].get('abbr');

                            dsCustomers.load ({
                            Params : {
                            entity : entity
                            }
                            });
                            }
                            }

                            Comment


                            • #15
                              This problem was[Solved]

                              I did not have the right code to derive the value from selcted item in the Drop Down Box
                              Below is the code that solved my issue

                              // User selected a value from DropDown Box

                              listeners : {
                              scope : this,
                              select : function(combo, recs){
                              var entity = combo.getValue(); *** This line did the trick ***
                              // Ext.Msg.alert(combo.getValue());
                              //Ext.Msg.alert('User Selected a New Entity:' + entity);

                              // Load EPCRSts grid with records based an a new value
                              dsCustomers.load ({
                              params : {
                              entity : entity,


                              }
                              });

                              Comment

                              Working...
                              X