Announcement

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

    CustomSQL - ComboBox

    I have a small question.

    Is it possible with smartclient to get a parameter from a combobox based on the selected value
    to use this values in a CustomSQL (operationBindung) - Datasource




    #2
    The ComboBox puts together criteria based on the selected value and send these to the server. Criteria can be used in customSQL - see the Custom Querying overview. Custom criteria can be submitted by overriding getPickListFilterCriteria(). See also getSelectedRecord() if the ComboBox is using an optionDataSource as the source of data - this allows you to get additional record values from the selected value, even if those values are not shown to the user.

    Comment


      #3
      See this sample for working with a selected value.

      Comment


        #4
        Hello,

        Thanks 4 the help it works perfect. But i have a lack of understanding to combine this with a listgrid that i want to filter.

        The filtering works of the Listgrid but it uses ID as filter criteria and i want to use "ARTNR" from the second combobox.
        Where is the right place to define the criteria?



        isc.DynamicForm.create({
        ID:"DynamicForm1",

        autoDraw: true,
        fields: [
        {name:"ID", title:"ID", editorType:"SelectItem",
        optionDataSource:"Datasource1",
        pickListFields: [
        { name: "ID" },
        { name: "COMMENT" },
        { name: "TEXT" }
        ], changed:"form.clearValue('ARTNR');"
        },

        {name: "ARTNR", title:"Artnr", editorType: "SelectItem",
        optionDataSource:"Datasource2",
        pickListFields: [
        { name: "ID" },
        { name: "ARTNR" },
        { name: "Nummer" },
        ],
        getPickListFilterCriteria : function () {
        var ID = this.form.getValue("ID");
        return {ID:ID};

        }
        },
        {
        ID:"IButton1",
        name:"Submit",
        title:"Submit",
        type: "button",
        autoDraw:"false",
        click: function() {


        ListGrid1.filterData(DynamicForm1.getValuesAsCriteria());


        }
        },
        ]
        })

        Comment


          #5
          You are actually using SelectItem, not a ComboBox, so that would only select a single value from the optionDataSource, therefore filtering by the valueField vs displayField would be the same..

          Even if you switched to a ComboBoxItem, while you could use the search string in cases where a user hasn't picked a value (its available via ComboBoxItem.getEnteredValue()), this would still be a strange interaction..

          Have you tried simply enabling the filterEditor (showFilterEditor:true)? This provides a powerful search mechanism integrated into the grid. The default behavior would already be both clearer and more powerful than what you've started on here.

          Comment


            #6
            Hi,

            and thx for your respond but I think it is not clear what I really want to achieve.
            I need the value that is selected and I only get the ID. I need the ARTNR number for my listgrid to filter with button click.
            On the first selection the user should select the ID that is needed for the second selection. That’s works but I only want to get the ARTNR from my second selection to use this for filtering and I don’t know to handle this.
            showFilterEditor:true is not an option for me in this case because I don’t want that the user have to enter the value. The value should come from the selection.

            Comment


              #7
              Create an object for the ARTNR-SelectItem. It has a selectedRecord, which has your Datasource2.ID, Datasource2.ARTNR and Datasource2.Nummer.
              This way you can build your ARTNR-only Criteria. Not a one-liner like ListGrid1.filterData(DynamicForm1.getValuesAsCriteria()), but still easy.

              Best regards
              Blama

              Comment

              Working...
              X