Announcement

Collapse
No announcement yet.

How to customize the search.js?

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

  • How to customize the search.js?

    I want to customize espocrm/client/src/views/record/search.js file.

    Can anyone help me with how to do this?

    Research:
    1. We have espocrm/client/src/views/list.js file which will define the searchView as views/record/search.
    2. Similarly, the recordView: 'views/record/list' is defined in theespocrm/client/src/views/list.js.
      1. I can define the custom: views/record/list in espocrm/custom/Espo/Custom/Resources/metadata/clientDefs/Lead.json.
    Can I do something like this for the search.js file also ?
    yuri
    Last edited by Ananya K; 05-12-2021, 10:27 AM.

  • #2
    Not sure if telecastg post tutorial related to the search function but there is quite a few resources that may or may not help you. Check the end of this link where I add most of telecastg's guide thread.

    Contribute to o-data/EspoCRM-Learning-and-Design development by creating an account on GitHub.

    Comment


    • Ananya K
      Ananya K commented
      Editing a comment
      We decided to publish short tutorial how to create custom filters which will be available for all users. You have to login to your ftp server and modify files. 1. Plan your filters Prepare list of filters and make changes in your files. Go to directory: /custom/Espo/Custom/Resources/metadata/clientDefs 2. Add translation Find file with name of … Custom Filters in EspoCRM Read More »

      Actually, this gave me an idea of how to resolve my problem.
      Thank u very much.

  • #3
    Perhaps this post can help you understanding Espo program structure for future reference

    The idea of this thread is to create a "road map/guide" to help developers find where GUI sections or elements are defined within Espo code so customization projects can be implemented without having to spend a lot of time "finding your way around" the code (like many of us have done) whenever possible.

    Comment


    • #4
      Hey,

      I want to clean up the advanced filter values when we refresh the page. Otherwise, we need to clean up the text box value and then enter the next value.

      So I want to add a button next to the Reset Button its a refresh which will clean up all the value in the advanced search field text box.

      To do this I need to edit the search.js

      Feature Request Pull Request: https://github.com/espocrm/espocrm/pull/1996

      yuri
      Attached Files
      Last edited by Ananya K; 05-13-2021, 06:17 PM.

      Comment


      • #5
        Hi,

        Here's how you can incorporate your custom search.js script for the Lead entity in a "upgrade safe" way while your pull request is approved:

        Define your own search.js class in the custom namespace. for example:
        client/custom/src/views/record/search.js
        Code:
        define('custom:views/record/search', 'views/record/search', function (Dep) {
        
            return Dep.extend({
        
        WRITE HERE ALL YOUR CUSTOM SEARCH CODE
        
            });
        });
        Define a custom header list view class that will invoke the custom search instead of the core class, for example:
        client/custom/src/views/header/list.js
        Code:
        define('custom:views/header/list', 'views/list', function (Dep) {
        
            return Dep.extend({
        
                searchView: 'custom:views/record/search'
        
            )};
        
        });
        Define a custom clientDefs metadata script to set the custom header list view as the "list view" for your target Entity ("Lead") class:
        custom/Espo/Custom/Resources/metadata/clientDefs/Lead.json
        Code:
        {
            "views": {
                "list": "custom:views/header/list"
            }
        
        }

        Clear cache and rebuild.

        Please post your custom implementation of search.js here when you are done, so other users will be able to benefit from your development too

        Comment


        • #6
          Hey telecastg

          This works cool. Thank you soo much for the help.

          Here are my custom search.js and search.tpl files.
          Attached Files

          Comment


          • telecastg
            telecastg commented
            Editing a comment
            Thanks for posting your solution, I'm sure that many other forum participants will benefit from your contribution.

        • #7
          Hi all, quick info for anyone following this thread. Ananya made a Pull Request for this I believe, too bad it is still Open though: https://github.com/espocrm/espocrm/pull/1996

          Comment

          Working...
          X