Announcement

Collapse
No announcement yet.

Ajax Get Makes The System Very Slow

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

  • Ajax Get Makes The System Very Slow

    Hello,

    ServiceDescriptions data is loaded using ajax. This works fine.

    But When I have more than 5-6 items in quote item list, the system becomes too slow to load, and it is the worst for more than 10 items.

    Can anyone please help me to solve this problem.

    Thanks.


    Espo.define('Advanced:Views.QuoteItem.Fields.Servi ceDescriptions', 'Views.Fields.Enum', function (Dep) {


    return Dep.extend({

    translatedOptions: null,

    setup: function () {
    Dep.prototype.setup.call(this);
    this.setupOptions();
    this.listenTo(this.model, 'change', function (model) {
    this.setupOptions();
    this.render();
    }, this);

    },
    setupOptions: function () {


    if (this.mode != 'list') {
    var url = 'Product/action/loadListItemField';
    this.translatedOptions = null;
    var list = [];
    var id = this.model.get('productId');

    $.ajax({
    url: url,
    data: {
    id: id,
    },
    type: "GET",
    dataType: 'json',
    async: false,
    }).done(function (respose) {
    list.push("");
    $.each(respose, function (i) {
    var val = respose[i].description;
    var listVal = val + "-" + respose[i].unit;
    list.push(listVal);
    });
    this.wait(false);
    }.bind(this));
    this.params.options = list;
    }

    },
    );
    });

  • #2
    Hello,
    check the operations you do in your action.

    Comment


    • #3
      Thanks Tanya,

      As you told, problem was with my query, which compares lot of rows to get the result which slowed down the system. Adding indexes helped me to fix the issue.

      Thanks again.

      Comment

      Working...
      X