Results 1 to 10 of 10
  1.    #1  
    I am developing an application with two listselectors, how can I prefilter the second list from the result of the first in Ares
  2. #2  
    More details please.
  3. #3  
    <<thread moved to Development forum>>
  4.    #4  
    Thanks for showing interest

    I have populated two lists using listselectors in Ares, such that list ONE contains A, B, C, D and list TWO contains E, F, G, H. How can I prefilter the second list such that when item A is selected from list ONE, it prefilters list TWO to show just F,G?

    The code I have so far is:

    function FinalAssistant(argFromPusher) {

    }

    FinalAssistant.prototype = {
    setup: function() {
    Ares.setupSceneAssistant(this);
    this.controller.listen('list1', Mojo.Event.listSelector1Tap, this.listSelector1Tap.bindAsEventListener(this));
    },
    cleanup: function() {
    Ares.cleanupSceneAssistant(this);
    },

    listSelector1Tap: function(inSender, event) {
    switch (event.choices.label)
    {
    case: 'A':
    this.listModel2.choices = [{label: "F"}, {label: "G"}];
    this.controller.modelChanged(this.listModel2);
    break;
    },


    },
    };
  5.    #5  
    Hi, am a newbie to app development.

    I am developing an app in Ares I want to prefilter a second listselector from the result of the first listselector such that if "A" is selected from the first it should prefilter the second to show only "B.

    The code so far is:

    function FourthAssistant(argFromPusher) {
    }

    FourthAssistant.prototype = {
    setup: function() {
    Ares.setupSceneAssistant(this);

    },
    cleanup: function() {
    Ares.cleanupSceneAssistant(this);
    },
    listSelector1Change: function(inSender, event) {

    this.listSelector3.choices[{label: "F", value: "1"}];
    },

    };

    Will appreciate your help
  6. #6  
    Since you haven't gotten much of a response here, I think you'd probably should post over here: https://developer.palm.com/distribut...forum.php?f=55
    Richard Neff

    My tutorials on WebOS development: Beyond 'Hello World!' | Getting Started - WebOS Development

    My apps: Percent Table | SierraPapa
  7. #7  
    Quote Originally Posted by Louis84 View Post
    this.controller.listen('list1', Mojo.Event.listSelector1Tap, this.listSelector1Tap.bindAsEventListener(this));
    You are part of the way there, but you don't look like you are specifying the right "event". You can read up on that here and here. In this particular case, you are probably looking for "Mojo.Event.propertyChange" as in:

    this.controller.listen('list1', Mojo.Event.propertyChange, this.listSelector1Tap.bindAsEventListener(this));
  8. #8  
    you could have a fillList function that you pass the tap event item into. Have a switch case inside the fillList function that will fill the list to whatever you want it to be depending on the event.item.

    var fillList= function(item){
    switch(item.value){
    case 1:
    for(i = 0 ; i < list.length; i++)
    ....
    break;
    .
    .
    .
    }
    };

    This depends on how you store your list elements.
  9.    #9  
    Thanks for the tips, I decided to work with the onChange Event and so far its filtering but the problem is that its not repeating the process.

    the code so far is


    function AccountsAssistant(argFromPusher) {
    }
    AccountsAssistant.prototype = {
    setup: function() {
    Ares.setupSceneAssistant(this);
    listModel2 = this.listModel2;
    listModel1 = this.listModel1;
    //choices = this.listModel1.choices, this.listModel2.choices;
    //this.controller.listen('listSelector1', Mojo.Event.propertyChange, this.listSelector1Change.bindAsEventListener,'listSelector2', this.listSelector2Change.bindAsEventListener(this));

    //choices[];
    },

    cleanup: function() {
    Ares.cleanupSceneAssistant(this);


    },

    listSelector1Change: function(inSender, event) {


    if (this.listModel1.choices =[{label:"One", value:"1"}]) {
    this.listModel2.choices = [{label: "Germany", value: "11"}];
    this.Controller.stageController.modelChanged(this.listModel2);
    // return Mojo.controller.modelChanged(this.listModel2);
    //break;


    if (this.listModel1.choices =[{label:"Two", value:"2"}]) {
    this.listModel2.Choices = [{label: "CEE", value: "12"}];
    this.Controller.stageController.modelChanged(this.listModel2);
    // return Mojo.controller.modelChanged(this.listModel2);
    //break;
    }

    }

    },
    listSelector2Change: function(inSender, event) {
    this.listModel1.choices = [{label: "One", value : "1"}, {label : "Two", value : "2"},{label : "Three", value : "3"}];
    this.controller.modelChanged(this.listModel1);
    }


    };
  10.    #10  
    Thanks all,

    I finally figured it out.

    the code is as follows


    function AccountsAssistant(argFromPusher) {
    }
    AccountsAssistant.prototype = {
    setup: function() {
    Ares.setupSceneAssistant(this);
    listModel3 = this.listModel3;
    listModel2 = this.listModel2;
    listModel1 = this.listModel1;

    //--------database connection--------///
    /*uname = 'root@localhost';
    passwd = '';
    //this.$.webService.getParameters({password: passwd, username: uname});
    this.$.webService1.execute();*/
    //----------End-------------------//
    },

    cleanup: function() {
    Ares.cleanupSceneAssistant(this);

    },
    listSelector1Change: function(inSender, event) {

    var webos;
    webos = this.listModel1.value;

    if (webos == '1') {
    this.listModel2.choices = [{label: "United Kingdom", value: "un"}, {label: "Germany", value: "ge"}];
    this.controller.modelChanged(this.listModel2);
    this.$.listSelector2.setValue(null);
    this.$.listSelector3.setValue(null);

    }

    if (webos == '2'){
    this.listModel2.choices = [{label : "San Francisco", value: "sa"}, {label: "France", value: "fr"}];
    this.controller.modelChanged(this.listModel2);
    this.$.listSelector2.setValue(null);
    this.$.listSelector3.setValue(null);
    }

    if (webos == '3'){
    this.listModel2.choices =[{label: "Palo Alto", value: "pa"}, {label: "Romania", value: "ro"}];
    this.controller.modelChanged(this.listModel2);
    this.$.listSelector2.setValue(null);
    this.$.listSelector3.setValue(null);

    }
    },

    listSelector2Change: function(inSender, event) {
    var ani;
    ani = this.listModel2.value;

    if (ani == 'un'|| ani == 'ge'){
    this.listModel3.choices = [{label: "Reading", value: "re"}];
    this.controller.modelChanged(this.listModel3);
    this.$.listSelector3.setValue(null);

    }

    if(ani == 'sa' || ani == 'fr'){
    this.listModel3.choices = [{label: "Bracknell", value: "br"}];
    this.controller.modelChanged(this.listModel3);
    this.$.listSelector3.setValue(null);

    }

    if (ani == 'pa' || ani == 'ro'){
    this.listModel3.choices = [{label : "London", value : "lo"}];
    this.controller.modelChanged(this.listModel3);
    this.$.listSelector3.setValue(null);

    }
    }
    };


    However, I have another problem,


    I have a php file which is successfully accessing data from a mysql database.

    I am having problem accessing the same data using the web service widget in Ares

    I have the following set up in Ares

    name: webService1
    url: ht t p://10.0.2.2/palm/test.php, (10.0.2.2) is used to root the emulator to the wamp server on the desktop
    method: GET
    parameterString: LastName (this is a column name in the database)
    parameter: LastName (this i am not sure if its correct)
    handleAs: xml
    content: application/x-w w w-form-urlencoded (this is a default setting)
    headers : {} (i left this empty because I am not sure what to pit in there)

    the assistant.jsjsjs $file$ $is$ $as$ $follows$:

    webService1Success: function(inSender, inResponse, inRequest) {
    var title = inResponse.getElementsByTagName("FirstName");
    console.log(Printed);

    },
    webService1Failure: function(inSender, inError) {
    console.log("Failure try again");

    },
    Last edited by Louis84; 06/22/2011 at 06:33 AM.

Tags for this Thread

Posting Permissions