success: function()

in dashboardv2/public/js/views/search/SearchResultLayoutView.js [334:387]


                    success: function(model, response) {
                        Globals.searchApiCallRef = undefined;
                        if (!(that.ui.pageRecordText instanceof jQuery)) {
                            return;
                        }
                        if (isPostMethod) {
                            that.searchCollection.referredEntities = model.referredEntities;
                            that.searchCollection.reset(model.entities);
                        }
                        if (that.searchCollection.models.length === 0 && that.offset > that.limit) {
                            that.ui.nextData.attr('disabled', true);
                            that.offset = that.offset - that.limit;
                            that.hideLoader();
                            return;
                        }
                        if (that.searchCollection.models.length < that.limit) {
                            that.ui.nextData.attr('disabled', true);
                        } else {
                            that.ui.nextData.attr('disabled', false);
                        }
                        if (that.offset === 0) {
                            that.pageFrom = 1;
                            that.pageTo = that.limit;
                        } else if (clickObj && clickObj.next) {
                            //on next click, adding "1" for showing the another records.
                            that.pageTo = that.offset + that.limit;
                            that.pageFrom = that.offset + 1;
                        } else if (clickObj && clickObj.previous) {
                            that.pageTo = that.pageTo - that.limit;
                            that.pageFrom = (that.pageTo - that.limit) + 1;
                        }
                        that.ui.pageRecordText.html("Showing  <u>" + that.searchCollection.models.length + " records</u> From " + that.pageFrom + " - " + that.pageTo);
                        if (that.offset < that.limit && that.pageFrom < 26) {
                            that.ui.previousData.attr('disabled', true);
                        }
                        that.renderTableLayoutView();

                        var resultArr = [];
                        if (that.searchCollection.queryParams.typeName) {
                            resultArr.push(that.searchCollection.queryParams.typeName)
                        }
                        if (that.searchCollection.queryParams.classification) {
                            resultArr.push(that.searchCollection.queryParams.classification)
                        }
                        if (that.searchCollection.queryParams.query) {
                            resultArr.push(that.searchCollection.queryParams.query)
                        }
                        var searchString = 'Results for: <span class="filterQuery">' + that.generateQueryOfFilter() + "</span>";
                        if (Globals.entityCreate && Globals.entityTypeConfList && Utils.getUrlState.isSearchTab()) {
                            searchString += "<p>If you do not find the entity in search result below then you can" + '<a href="javascript:void(0)" data-id="createEntity"> create new entity</a></p>';
                        }
                        that.$('.searchResult').html(searchString);

                    },