Set filter value in custom JS view for list view

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Firyo
    Senior Member
    • Jun 2022
    • 134

    Set filter value in custom JS view for list view

    Hi there,

    I'm currently looking for a way to set the value of the "Filter" dropdown of a specific entity's list view from a custom JS view.

    The custom view is a dashlet.
    It contains links that are displayed next to the key numbers about an entity.

    So I would like that when the user click on a link, the filter is edited before landing on the page.

    I'm talking about this filters :
    Click image for larger version

Name:	opera_J6uXBjf40t.png
Views:	565
Size:	297.9 KB
ID:	90904


    Tell me if this isn't clear enought btw.​
  • Firyo
    Senior Member
    • Jun 2022
    • 134

    #2
    Hi,
    First of all, thanks for your answer.

    How am I supposed to get the 'myListView' variable ?

    The custom view I'm talking about is a dashlet.
    I don't have the context of the list view.

    Comment

    • yuri
      Member
      • Mar 2014
      • 8453

      #3
      I think it was an AI generated answer.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8453

        #4
        See https://github.com/espocrm/espocrm/b...search.js#L500

        For the regular list view. Access the search view from the parent list view:

        Code:
        this.getSearchView().selectPreset(filterName);

        For the dashlet. You can access collection.

        Code:
        this.collection.data.primaryFilter = myFilterName;
        Last edited by yuri; 04-18-2023, 06:58 AM.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • Firyo
          Senior Member
          • Jun 2022
          • 134

          #5
          Ok, but is there a way to run either of these from my dashlet and affect the X entity list view?

          Comment

          Working...