4 tiered cascading drop-downs with 'none' option


Posted by Nigel Hertz - Nov 10 ’15 at 05:42

Hi, we have a situation where we have a department, region, group and team that are configured via cascading dropdowns. Each level below department has an option of being "none" (i.e. departmental manager).

I've gone and added several "none" values (for each option really) which works fine when editing via the forms, however if you go in via dtasheet view, there's around 30 versions of "none" depending on the scenario. Is there any way around this?



Dept-1     Region-1     Group-1     None

Dept-1     Region-1      None        None

Dept-1     None            None        None

Dept-2     Region-4     Group-3     Team-6

Dept-2     Region-4     Group-3     None

Dept-3     None           None          None

Dept-4     Region-6     None        None

  • rostislav
    Member for: 7 years 11 days
    #1 by rostislav Nov 10 ’15 at 08:05


    You can simply have one "none" entry per list instead of the 30 and include that entry in your filtering using the or operator, like this (using the example from the how-to):

    function (term, page) {
      // Getting the selected country
      var countryId = fd.field('Country').value();
      if (!countryId) {
        countryId = 0;
      //the id of the "none" entry
      var noneId = 2;
      if (!term || term.length == 0) {
        return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Country/Id&$orderby=Created desc&$expand=Country/Id&$filter=Country/Id eq " + countryId + " or Id eq " + noneId + "&$top=10";
      return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Country/Id&$orderby={LookupField}&$expand=Country/Id&$filter=startswith({LookupField}, '" + term + "') and (Country/Id eq " + countryId  + "or Id eq " + noneId + ")&$top=10";

    This will solve the multiplication of none records, however do note that you cannot have cascading dropdowns in the data sheet view, in case you were trying the implement that. If needed, you can disable the quick edit mode of the data sheet view so as to prohibit wrong data entry, see this link on how to achieve this.

  • Nigel Hertz
    Nigel Hertz
    Member for: 6 years 6 months 8 days
    #2 by Nigel Hertz Nov 10 ’15 at 09:00

    Brilliant, thank you very much for that. That's exactly what I was looking for.


    I had a feeling it might not work in datasheet view; that's not a problem - just education for the users smile

Displaying 1 to 2 of 2 messages