Skip to Content
avatar image
Former Member

how to remove all items in dropdowns with single click of button Ds 1.6

searched blogs before posting but not fulfilled my requirement

https://archive.sap.com/discussions/thread/3388707

HI Experts,

i have a requirement where i need to remove all items in dropdown by single of button

i have written following code inside a button

PROJ_NO.removeAllItems();
PROJ_NO.setItems(DS_1.getMemberList("0PROJECT", MemberPresentation.EXTERNAL_KEY, MemberDisplay.KEY, 1000 , " "));

SALES_ORG.removeAllItems();

SALES_ORG.setItems(DS_1.getMemberList("0SALESORG", MemberPresentation.EXTERNAL_KEY, MemberDisplay.KEY,1000, " "));

and so on

but unfortunately it was removing only first item no idea where i am missing

could anyone guide me that would really appreciated

Thanks,

Varun

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Jan 12, 2017 at 02:58 PM

    Hi Varun,

    Since you are using Design Studio 1.6, instead of populating the drop down lists using scripting, you should populate them using property binding. Then in the Clear Filters button script you can specify DS_1.clearAllFilters(). There is no need for a Submit button when you are implementing cascading filters.

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      HI Mustafa/ Boopalan,

      yes you both are right now .now issue is resolved thanks for your help both of you

      Thanks,

      varun

  • avatar image
    Former Member
    Jan 12, 2017 at 01:11 AM

    Hi Varun.

    Do you mean when you click the button,the dropdown will clear,and then add a new list value to dropdown?

    I've tried,from my understanding,you can try like this:

    PROJ_NO.removeAllItems();
    PROJ_NO.setItems(DS_1.getMemberList("0PROJECT", MemberPresentation.EXTERNAL_KEY, MemberDisplay.KEY, 1000));

    Hope can help you.

    Regards,

    Jing

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 11, 2017 at 11:35 PM

    Hi Varun,

    Based on your code, it is not possible to test whether the issue is with removeAllItems() or with setItems(). I suggest that for testing purposes you first comment out all the setItems() commands to confirm the result of removeAllItems() in isolation.

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 12, 2017 at 06:20 AM

    Hi Varun,

    From your code, it seems you want to set items the same items again after removing it.

    It shows like the first item is removed in dropdown because you set the first item of dropdown as a null value in your code.

    PROJ_NO.setItems(DS_1.getMemberList("0PROJECT", MemberPresentation.EXTERNAL_KEY, MemberDisplay.KEY, 1000 , " "));

    So your code is working as expected.

    Do you want to set the filterd items of dimension in your dropdown?

    Thanks,

    Poovarasan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 12, 2017 at 08:10 AM

    HI All,

    Thanks for your all replies i will explain in detail what i am facing exactly

    if you can see my below screenshot i have 10 drop downs (cascading) if i select sales org the corresponding customer and machine type so on... will fill in the drop down

    when i click on submit data will reflect all components

    the idea of clear filter is when i click on clear filter button it should remove all items which are filtered in drop down and add all items in drop down

    for example i have 10 sales org and 20 machines out of 10 sales org if user selects 1 sales org corrosponding machine types will come lets take 1 sales org we have 3 machines in drop down we can see 3 machine id as soon as i click on clear filter button it should remove all 3 machines and fill with 20 values (initial state) .

    hope you guys got it .could anyone give me hint here?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 12, 2017 at 03:52 PM

    Hi Varun,

    You don't need to use remove all items if you are using set items. Set items script will automatically remove all item and set the items you give.

    I think the problem may be with the filter. Can you show us how you are passing filter to the data DS_1 on selection of dropdown in your code.

    Thanks,

    Poovarasan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      HI Boopalan,

      Your answer also helped me but i have no idea where to select helpful answer.please let me know

      Thanks,

      Varun