Commit 05277c27 by Shwetha GS

ATLAS-1064 UI: Pagination for full text search results (Kalyanikashikar via shwethags)

parent 4bc3e738
......@@ -21,7 +21,7 @@
<div class="ellipsis"><span class="searchResult" style=" font-size: 16px;"></span></div>
<div class="searchTable">
<span class="labelShowRecord pull-left" data-id="pageRecordText"></span>
<div data-id="paginationDiv" style="display:none">
<div data-id="paginationDiv">
<ul class="pager pull-right">
<li>
<button class="btn" data-id="previousData" disabled=true>Previous</button>
......
......@@ -308,9 +308,9 @@ define(['require',
renderFooterRecords: function(collectionState) {
var collState = collectionState;
var totalRecords = collState.totalRecords || 0;
var pageStartIndex = totalRecords ? (collState.currentPage * collState.pageSize) : 1;
var pageStartIndex = totalRecords ? (collState.currentPage * collState.pageSize) : 0;
var pageEndIndex = pageStartIndex + this.collection.length;
this.$('[data-id="r_footerRecords"]').html('<h5>Showing ' + (totalRecords ? pageStartIndex + 1 : 0) + ' - ' + pageEndIndex + '</h5>');
this.$('[data-id="r_footerRecords"]').html('<h5>Showing ' + (totalRecords ? pageStartIndex + 1 : 1) + ' - ' + pageEndIndex + '</h5>');
return this;
},
/**
......
......@@ -117,18 +117,13 @@ define(['require',
this.limit = 25;
this.firstFetch = true;
this.fetchList = 0;
if (options.value.searchType === "dsl" || options.value.type === "dsl") {
pagination = false;
this.offset = 0;
} else {
pagination = true;
}
this.offset = 0;
this.commonTableOptions = {
collection: this.searchCollection,
includeFilter: false,
includePagination: pagination,
includePagination: false,
includePageSize: false,
includeFooterRecords: pagination,
includeFooterRecords: false,
includeSizeAbleColumns: false,
gridOpts: {
emptyText: 'No Record found!',
......@@ -210,10 +205,8 @@ define(['require',
if (value) {
if (value.searchType) {
this.searchCollection.url = "/api/atlas/discovery/search/" + value.searchType;
if (value.searchType === "dsl") {
$.extend(this.searchCollection.queryParams, { limit: this.limit });
this.offset = 0;
}
$.extend(this.searchCollection.queryParams, { limit: this.limit });
this.offset = 0;
}
_.extend(this.searchCollection.queryParams, { 'query': value.query });
}
......@@ -246,7 +239,6 @@ define(['require',
that.checkTableFetch();
that.offset = that.offset - that.limit;
if (that.firstFetch) {
that.ui.paginationDiv.hide();
that.renderTableLayoutView();
}
}
......@@ -318,11 +310,6 @@ define(['require',
this.$('.fontLoader').hide();
this.$('.searchTable').show();
this.$('.searchResult').show();
if (this.value.searchType == "dsl" || this.value.type === "dsl") {
this.ui.paginationDiv.show();
} else {
this.ui.paginationDiv.hide();
}
}
},
getEntityTableColumns: function() {
......@@ -621,11 +608,9 @@ define(['require',
onClicknextData: function() {
var that = this;
this.ui.previousData.removeAttr("disabled");
that.offset = that.offset + that.limit;
$.extend(this.searchCollection.queryParams, {
offset: function() {
that.offset = that.offset + that.limit;
return that.offset;
}
offset: that.offset
});
this.previousClick = false;
this.fetchCollection();
......@@ -633,11 +618,9 @@ define(['require',
onClickpreviousData: function() {
var that = this;
this.ui.nextData.removeAttr("disabled");
that.offset = that.offset - that.limit;
$.extend(this.searchCollection.queryParams, {
offset: function() {
that.offset = that.offset - that.limit;
return that.offset;
}
offset: that.offset
});
this.previousClick = true;
this.fetchCollection();
......
......@@ -6,6 +6,7 @@ INCOMPATIBLE CHANGES:
ALL CHANGES:
ATLAS-1064 UI: Pagination for full text search results (Kalyanikashikar via shwethags)
ATLAS-1006 Paginate full text search results (shwethags)
ATLAS-1046 UI: Search pagination refinements (Kalyanikashikar via sumasai)
ATLAS-1056 Differentiate between tag and term using attribute "taxonomy.namespace" (kevalbhat18 via sumasai)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment