Announcement

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

    Binding a comboBox to a ListGrid?

    How would I be able to filter between different options on a combo box and have filtered on the ListGrid?




    isc.ClassFactory.defineClass("BillingStatementsPanel", ScreenPanel).addProperties({
    panelTitle: "Billing Statements",
    billingGridDefaults: {
    _constructor: isc.ListGrid,
    width: "100%",
    height: 300,
    minHeight: 125,
    margin: 5,
    showResizeBar: true,
    autoParent: "panelCanvas",
    autoFitFieldWidths: true,
    autoFitWidthApproach: "both",
    showFilterEditor: true,
    dataSource: "rscReacctBillingStatements",
    autoFetchData: true,
    recordClick : function() {
    this.creator.rowChanged();
    },
    recordDoubleClick : function() {
    var selectedReport = this.getSelectedRecord();
    if (selectedReport == null) {
    isc.say("You must select one record");
    return;
    }
    rscReacctBillingStatements.downloadFile(selectedReport);
    }
    },





    comboBoxFormDefaults: {
    _constructor: isc.DynamicForm,
    autoParent: "controlButtonLayout",
    width: 1,
    height: 1,
    wrapItemTitles: false,
    fields : [
    {
    name: "showComboBox", title: "Show",
    editorType: "ComboBoxItem",
    align: "right",
    valueMap : {
    "all" : "All",
    "readyForApproval" : "Ready for Approval",
    "readyForSending" : "Ready for Sending",
    "errorsInSending" : "Errors in Sending",
    },
    defaultToFirstOption: true,
    change: function() {
    var cl = this.getClass();
    isc.say(cl);
    }
    }]
    },


    Thank you

    #2
    Just the take the value from the comboBox and call fetchData() on the grid, using the value to construct your criteria.

    Note: please use CODE tags around your code to keep from losing all indentation.

    Comment


      #3
      Could you possibly show me what that would look like? Or an example of how to take that value and put it in the listGrid and calling fetchData.

      Sorry and thank you.

      Comment


        #4
        You mean like...

        Code:
            grid.fetchData({ [I]someField[/I] : [I]valueFromComboBox[/I]  });
        ??

        Comment


          #5
          Ahh yes, thank you.

          Also if I need to set a criteria for the field how would I put that in within the code.

          Ex: If someField needed to be false.

          Comment


            #6
            Did you mean:

            Code:
             
                 grid.fetchData({ [I]someField[/I]: false, [I]someOtherField[/I] : [I]valueFromComboBox[/I]  });
            ?

            Comment


              #7
              Do I need to define the valueFromComboBox somewhere else other than the Combo Box? I seem to get an error saying I have not defined it.

              billingGridDefaults: {
              _constructor: isc.ListGrid,
              width: "100%",
              height: 300,
              minHeight: 125,
              margin: 5,
              showResizeBar: true,
              autoParent: "panelCanvas",
              autoFitFieldWidths: true,
              autoFitWidthApproach: "both",
              showFilterEditor: true,
              dataSource: "rscReacctBillingStatements",
              fetchData: {
              bill_approved:false, bill_approved : readyForApproval,},


              recordClick : function() {
              this.creator.rowChanged();
              },
              recordDoubleClick : function() {
              var selectedReport = this.getSelectedRecord();
              if (selectedReport == null) {
              isc.say("You must select one record");
              return;
              }
              rscReacctBillingStatements.downloadFile(selectedReport);
              }
              },



              comboBoxFormDefaults: {
              _constructor: isc.DynamicForm,
              autoParent: "controlButtonLayout",
              width: 1,
              height: 1,
              wrapItemTitles: false,
              fields : [
              {
              name: "showComboBox", title: "Show",
              editorType: "ComboBoxItem",
              align: "right",
              valueMap : {
              "all" : "All",
              "readyForApproval" : "Ready for Approval",
              "readyForSending" : "Ready for Sending",
              "errorsInSending" : "Errors in Sending",
              },
              defaultToFirstOption: true,
              change: function() {
              var cl = this.getClass();
              isc.say(cl);
              }
              }]
              },

              Comment


                #8
                fetchData is a method, not a property. You would be calling it from the changed handler on the ComboBoxItem. Aside from doing nothing, your definition is just going to crash at app load, since "readyForApproval" is presumably not defined as a JavaScript variable.

                We're ending up coaching you on JavaScript usage here, which is not what our Support packages are intended for. Can we sign you up for some training instead? Or perhaps get some consulting hours where you can do pair programming with one of our developers?

                Comment


                  #9
                  Awesome thanks for that. ;-)

                  Comment

                  Working...
                  X