Announcement

Collapse
No announcement yet.

Search field in Print to PDF dialog

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

  • Search field in Print to PDF dialog

    Hi!

    I would find it very practical if there was a search field in the template selection dialog. As we have several templates, this would make our work easier. Ideally a "live search", so that results are already displayed (filtered) while typing.

    Thanks in advance,
    Stefan

  • #2
    Personally, in this situation I use Ctrl+f and then enter the search word. If such a workaround suits you, of course.

    Click image for larger version

Name:	image.png
Views:	100
Size:	19.5 KB
ID:	109217

    Comment


    • Stefan
      Stefan commented
      Editing a comment
      Thank you for the answer victor. But I have more than 25 templates and not all templates are automatically loaded. So that would not really be a suitable solution for me.

  • #3
    you can create a custom list view and use your own select-template file which extend original and only enable search panel.
    Rabii
    Web Dev

    Comment


    • Stefan
      Stefan commented
      Editing a comment
      Can you tell me more about how to do this rabii?

  • #4
    You can create a custom recordViews list for lead entity and there you can overwrite the action printToPdf where you can use the same code but just create a custom select-template modal which extends the original with a change which is making searchPanel true.
    Rabii
    Web Dev

    Comment


    • #5
      So I made a custom/record/list to override massActionPrintPdf:

      Code:
       massActionPrintPdf()
       {
        [...]
      ​
        this.createView('pdfTemplate', 'custom:views/modals/select-template',
        {
             entityType: this.entityType,
        }
      }​
      But I have no idea how to extend the original select-template modal. I've tried it like this, but that doesn't work:

      Code:
      define('custom:views/modals/select-template', ['views/modals/select-records'], function (Dep) {
          return Dep.extend({
              setup: function ()
              {
                  Dep.prototype.setup.call(this);
                  this.searchPanel = true;
              }
       
          });
      });​
      Could you help me with this?

      Comment


      • #6
        Hey Stefan

        here is the correct code

        PHP Code:
        define('custom:views/modals/select-template', ['views/modals/select-records'], function (Dep) {
            
            return 
        Dep.extend({

                
        searchPaneltrue,

                
        setup: function () {
                    
        Dep.prototype.setup.call(this);
                },
         
            });
        });
        ​ 
        I hope this helps
        Rabii
        Web Dev

        Comment


        • #7
          Thank you for your help rabii, but if I use this code I get following errors and the list with the templates doesn't appear.

          Code:
          Uncaught (in promise) TypeError: Cannot read properties of null (reading 'indexOf')
          Code:
          GET https://[MY-DOMAIN]/api/v1//layout/filters 404 (Not Found)

          Comment


          • #8
            try this it was a mistake in the extended class name. you should extend the select-template class

            PHP Code:
            define('custom:views/modals/select-template', ['views/modals/select-template'], function (Dep) {
                
                return 
            Dep.extend({

                    
            searchPaneltrue,

                    
            setup: function () {
                        
            Dep.prototype.setup.call(this);
                    },
             
                });
            });
            ​​ 
            Rabii
            Web Dev

            Comment


            • #9
              Yeah, that's it. Thank you very much rabii !!

              Comment


              • rabii
                rabii commented
                Editing a comment
                you are welcome
            Working...
            X