Dynamic logic not working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krishnapriya
    Senior Member
    • Aug 2017
    • 209

    Dynamic logic not working

    Click image for larger version

Name:	dynamic logic.png
Views:	475
Size:	8.4 KB
ID:	32873

    Hello,

    dynamic logic of user = 'Some user' not working.Please help
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello
    Can't reproduce it on the demo.

    Comment

    • krishnapriya
      Senior Member
      • Aug 2017
      • 209

      #3
      Click image for larger version

Name:	visibility.png
Views:	495
Size:	37.4 KB
ID:	32965
      This is not working. Field quantity is always visible regardless of product.
      Please help to fix this.
      ​​​​​​​Thanks

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        Because you are on Quote view, but not on Quote item. Quote item is hidden
        Items in quote is built with other logic, and this table could be modified only with file modification

        Comment

        • krishnapriya
          Senior Member
          • Aug 2017
          • 209

          #5
          Tried to modify file.

          Not working.

          Can you please help

          Comment

          • krishnapriya
            Senior Member
            • Aug 2017
            • 209

            #6
            Espo.define('Advanced:Views.QuoteItem.Fields.Quant ity', 'Views.Fields.integer', function (Dep) {

            return Dep.extend({

            setup: function () {
            this.setReadOnly(true); ////////////////////////////////////////////// working


            this.listenTo(this.model, 'change', function (model) {
            if(model.get("productName")=="Afrobat Rider"){
            this.setNotReadOnly(true);
            }
            }, this);

            Dep.prototype.setup.call(this);
            }

            });
            });


            Not working.
            Is this the way of doing that?
            Please help.

            Comment

            • tanya
              Senior Member
              • Jun 2014
              • 4308

              #7
              Hi EspoCRM users, I‘m working with the Quote module from the Advanced Pack. Changing entities works fine but I miss the configuration (calculation and

              Comment

              • krishnapriya
                Senior Member
                • Aug 2017
                • 209

                #8
                Sorry I couldn't find any help with this link.

                readOnlyDisabled: false in item.js makes the field hidden, but how to make it visible again on changing product, Thats y I tried like above

                Comment

                • tanya
                  Senior Member
                  • Jun 2014
                  • 4308

                  #9
                  client/modules/advanced/src/views/quote/record/item.js
                  add listener in afterRender

                  Comment

                  • krishnapriya
                    Senior Member
                    • Aug 2017
                    • 209

                    #10
                    Tried to do with addClass("hidden") in listener written in afterRender.

                    It hides the element but it comes back suddenly.

                    afterRender: function () {
                    this.listenTo(this.getView('name'), 'change', function () {
                    this.handleField();
                    }, this);
                    }
                    handleField:function () {
                    if (this.model.get('name') == "miscellaneous") {
                    this.$el.find('input[name="quantity"]').removeClass("hidden");

                    } else {

                    this.$el.find('input[name="quantity"]').addClass("hidden");
                    }
                    },


                    Don't understand whats wrong with this code.

                    Please help

                    Comment

                    • krishnapriya
                      Senior Member
                      • Aug 2017
                      • 209

                      #11
                      I had to call handleField function in every field's event listeners.

                      Now working.

                      Comment

                      • krishnapriya
                        Senior Member
                        • Aug 2017
                        • 209

                        #12
                        this.getView('brand').setMode("edit"); not working

                        Comment

                        Working...