Announcement

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

    ComboBoxItem and dependant selects

    Using: SmartClient_v110p_2017-05-15_PowerEdition

    I'm hoping to create a comboBoxItem where the picklist is filtered based both on the user's input to the comboBox and the selection in anther field. I have a function to override getPickListFilterCriteria that works to filter the pickList based on the selection in the other field, but it currently kills the filtering based on the user input to the comboBox. So I'd like to know how to access the user input from within my getPickListFilterCriteria function so that it can return a criteria that includes both constraints.

    Code:
    isc.DataSource.get("buildings").fetchData(null,"window.buildings = data");

    isc.ListGrid.create({
    ID:"spaceAssignGrid",
    autoDraw:false,
    autoFetchData:true,
    dataSource:"roomAssignments",
    fields:[
    {
    name:"roomNumber",
    width:70,
    editorType:"ComboBoxItem",
    editorProperties:{
    optionDataSource:"rooms",
    getPickListFilterCriteria : function () {
    var code_Building = this.grid.getEditedCell(this.rowNum, "buildingNameShort");
    code_Building = window.buildings.getValueMap("buildingNameShort","code")[code_Building];
    return {code_Buildings:code_Building};
    },
    displayField:"roomNumber",
    valueField:"id",
    },
    },
    {
    name:"buildingNameShort",
    editorType:"selectItem",
    editorProperties : {
    optionDataSource:"buildings"
    }
    },
    ...etc.

    Thanks
    Russ Poyner

    #2
    Use getEnteredValue() to retrieve the search string entered by the user.

    Comment


      #3
      That did it. I did some re-factoring of my foreign key names to simplify things. The code below is working as I hoped:



      {
      name:"buildingNameShort",
      editorType:"ComboBoxItem",
      editorProperties : {
      optionDataSource:"buildings",
      displayField:"buildingNameShort",
      valueField:"code_Buildings"
      }
      },
      {
      name:"roomNumber",
      width:70,
      editorType:"ComboBoxItem",
      editorProperties:{
      optionDataSource:"rooms",
      getPickListFilterCriteria : function () {
      var selectedBuilding = this.grid.getEditedRecord(this.rowNum);
      return {
      code_Buildings:selectedBuilding.buildingNameShort,
      roomNumber:this.getEnteredValue()
      };
      },
      displayField:"roomNumber",
      valueField:"id_Rooms",
      },
      },

      Comment

      Working...
      X