Announcement

Collapse
No announcement yet.

Set filter value in custom JS view for list view

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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:	349
Size:	297.9 KB
ID:	90904


    Tell me if this isn't clear enought btw.​

  • #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


    • #3
      I think it was an AI generated answer.

      Comment


      • #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.

        Comment


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

          Comment

          Working...
          X