Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Populating SelectItem valueMap causiing a problem.

    Hi , I'm trying to populate value map of SelectItem with an rpc call , I do need the some values from the database.
    My current code is:

    private static SelectItem getProfessorSelection() {
    final SelectItem profSelection = new SelectItem();
    profSelection.setName("description");
    profSelection.setTitle("Professor");
    profSelection.setColSpan(4);
    profSelection.setDefaultToFirstOption(true);
    profSelection.setVisible(user.isAdmin());
    professorService.readProfessors(new AsyncCallback<FetchResult<ProfessorDto>>() {

    public void onFailure(Throwable caught) {
    // TODO Auto-generated method stub

    }

    public void onSuccess(FetchResult<ProfessorDto> result) {
    // TODO Auto-generated method stub
    List<String> valueMap = new ArrayList<String>();
    for(ProfessorDto professorDto:result.getFetchedList()){
    valueMap.add(professorDto.getFirstNameField());
    }
    String[] array = new String[]{};
    profSelection.setValueMap(valueMap.toArray(array));
    }

    });
    return profSelection;

    }
    I have this error which does not appear when the values are hardcoded:

    0:01:13,232 [ERROR] 19:55:02.803:MUP1:ERROR:ResultSet:isc_ResultSet_2 (created by: isc_PickListMenu_0):Invalid dataSource: null, a ResultSet must be created with a valid DataSource
    Stack trace:

    ResultSet.init(Obj, Obj, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) [a]MathFunction.completeCreation(_1=>Obj, _2=>Obj, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) [c]Class.create(_1=>Obj, _2=>Obj, _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) DataSource.getResultSet(_1=>Obj) Canvas.createDataModel(_1=>Obj, _2=>Obj{ID:auto_fetch}, _3=>Obj) Canvas.filterWithCriteria(_1=>Obj, _2=>Obj{ID:auto_fetch}, _3=>Obj) Canvas.$15a(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj) [a]MathFunction.invokeSuper(_1=>null, _2=>"$15a", _3=>undef, _4=>undef, _5=>undef, _6=>undef, _7=>undef, _8=>undef, _9=>undef, _10=>undef, _11=>undef, _12=>undef, _13=>undef) [a]MathFunction.Super(_1=>"$15a", _2=>Array[4], _3=>[object Arguments]) ListGrid.$15a(_1=>"filter", _2=>Obj, _3=>Obj, _4=>Obj, _5=>undef) Canvas.filterData(_1=>Obj, _2=>Obj, _3=>Obj) PickList.filterDataBoundPickList(_1=>Obj, _2=>true) PickList.$528(_1=>false, _2=>Obj, _3=>null, _4=>true) PickList.filterPickList(_1=>false, _2=>false, _3=>Obj, _4=>true) PickList.setUpPickList(_1=>false, _2=>false, _3=>Obj, _4=>true) PickList.makePickList(_1=>false, _2=>Obj, _3=>false, _4=>true) SelectItem.makePickList(_1=>false, Obj, false, true) PickList.fetchData(_1=>null, _2=>Obj, _3=>true) PickList.getFirstOptionValue() SelectItem.getDefaultValue() FormItem.init(Obj{name:description}, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef) ** recursed on [a]MathFunction.invokeSuper

    #2
    up

    Comment


      #3
      Does anybody in this forum knows how to populate a value map from the server in simple dropdown ?

      Comment


        #4
        Hi nasdaq,

        if the server is SQL, you'll need a database table, a matching (metadata) .ds.xml file, load that file on the client via DataSourceLoader, create a SelectItem, assign your DataSource as optionDataSource.
        If your server is not SQL, see the Quick Start Guide. Even for SQL, you should really read the QSG cover to cover.

        Just have a look at builtInDS sample, which does exactly this (and more) with a local SQL server.

        Best regards
        Blama

        Comment


          #5
          10x Again Blama !
          It seems that you are the only member to maintain and cover this forum.
          Actually I'm trying exactly this right now . I was wondering if there is another option apart from using data source for populating dynamic values from the server? Just because I dont want to make a DS for every single dynamic dropdown.

          Cheers

          Comment


            #6
            Hi nasdaq,

            Please define "dynamic values".
            • Different WHERE clause: See operationBinding in the .ds.xml docs (or optionDataSourceCriteria on the client)
            • Different table, same structure: See tableClause in the same docs
            • Different table, somewhat different structure: See tableClause + outputs in the same docs.
            • Dynamic structure: See serverside DynamicDSGenerator (also in the QSG)

            Best regards
            Blama

            Comment


              #7
              Also: see the FAQ for why we don't recommend using GWT-RPC (as shown in your first post), and for the basics you need to post in order to get help (like versions).

              Finally, aside from the above problems, the code you showed could not result in the error you showed - you definitely won't get attention if you are posting code that is missing key pieces.

              Comment


                #8
                Hi , no such key peaces are missing just not good error handling and logging per my oppinion. The reason for this log was that the dropdown is rendered before the rpc response is catched .

                @Blama
                Otherwise I overcome the issue by using data source for covering the dropdown component value map. 10x again .
                I'm not sure if it's the best solution but at least is working which is verry importent when working with smartgwt

                @Isomorphic
                I have couple of side posts with screenshots and I think enought progress info about them ,you can take a look if you want to defend the product.

                Comment


                  #9
                  We have not been receiving notifications when you post. We're not sure how you did that - seems to be you only out of all of the users of this forum.

                  As far as your other posts, you really really need to read the FAQ, as we recommended, both in order to see the required information you always need to post, and to understand why GWT-RPC is a bad idea.

                  If you don't make the trivial effort to post necessary details, please don't expect responses from Isomorphic - outside of paid support, we focus on helping people who make it possible to help them.

                  Comment


                    #10
                    Originally posted by Isomorphic View Post
                    We have not been receiving notifications when you post. We're not sure how you did that - seems to be you only out of all of the users of this forum.

                    As far as your other posts, you really really need to read the FAQ, as we recommended, both in order to see the required information you always need to post, and to understand why GWT-RPC is a bad idea.

                    If you don't make the trivial effort to post necessary details, please don't expect responses from Isomorphic - outside of paid support, we focus on helping people who make it possible to help them.

                    I'll try to answer you paragraph by paragraph

                    It's me who should ask you how it's possible to make such account in your forum and why you dont receive notifications.

                    I checked this but I cannot use it. Maybe is good to send a link for the other guys who read this in future.

                    If you don't make the trivial effort to ask for more info please don't expect to have people's attention on the product. Paid support is for people who try the unpaid already.

                    Comment

                    Working...
                    X