Announcement

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

    HowTo: SelectItem, multiple:true, allowEmptyValue: true

    Have a js DataSource defined as follows:

    Code:
    isc.DataSource.create({
    	ID: "testTreeDS",
    	dataFormat: "json",
    	clientOnly: true,
    	dataURL: "resources/test-data/aggregatedSkuMktData.js",
    
        fields: [
            {name: "id", title: "ID", type: "integer", primaryKey: true, hidden: true},
            {name: "parent", title: "Parent", foreignKey: "id", hidden: true},
            {name: "name", title:"SKU"},
            {name: "skudescription", title:"Description"},
            {name: "market", title:"Market", optionDataSource: "skuMktDS", allowEmptyValue: true, multiple: true},
            {name: "userretail", title:"User Retail", canEdit: true},
            {name: "networkid", hidden: true}
        ]
    });
    And here is the code for the TreeGrid:
    Code:
        var treeGrid = isc.TreeGrid.create({
            ID:"skuMarketTreeGrid",
            width: "100%",
            height: "100%",
            autoFetchData: true,
            dataSource: testTreeDS,
            keepParentsOnFilter: true,
            selectionAppearance: "checkbox",
            showFilterEditor: true,
            allowFilterExpressions: true,
            cascadeSelection: true,
            useAllDataSourceFields: true,
            loadDataOnDemand: true,
            showPartialSelection: true,
            folderIcon: null,
            nodeIcon: null,
            alternateRecordStyles: true,
            border: "none",
            borderRadius: "5px"
        });
    In the filter dropdown, it is correctly using a SelectItem and the checkboxes show up for the multiple selection. However, there is no entry for null/empty/none/etc. If I set multiple to false, I can see an empty entry in the filter.

    Is this because I'm using a databound SelectItem or something? What am missing? Here is the DS for the optionDataSource.

    Code:
    isc.DataSource.create({
    	ID: "skuMktDS",
    	dataFormat: "json",
    	clientOnly: true,
    	dataURL: "resources/test-data/skuMktData.js",
    
        fields: [
            {name: "id", type: "integer", primaryKey: true, hidden: true},
            {name: "market", title: "Market", type: "text"}
        ]
    });

    #2
    The empty value isn't operative for multiple selects because the meaning of the empty value is that the value for the FormItem becomes null. So selecting the empty value and other values in a multi-select would be a kind of nonsense choice to offer: "What would you like for breakfast?" with an answer of "Coffee, Toast and Nothing".

    Were you trying to use the empty value to mean something other than null?

    Comment


      #3
      Yes, we need something that essentially says "unselect all" - no filter.

      It makes total sense to not allow null to be part of a multi-select of other values. How do we "reset" a column filter for a multi-select then?

      Comment


        #4
        Just add a call to setValue(null), perhaps from a FormItemIcon.

        A bit bleeding edge, but 5.0 has a SelectItem.specialValue feature that would allow you to put a non-scrolling line in the PickList to clear values.

        Comment


          #5
          Okay. I'll look into the ListGrid API and see about setting the filter value to null for a particular field.

          Comment

          Working...
          X