fixed filter update issue

This commit is contained in:
sunilyadav840 2021-08-11 22:12:37 +05:30
parent 046e6eb5a4
commit e95245f1df
2 changed files with 16 additions and 11 deletions

View File

@ -535,7 +535,6 @@ input::-webkit-inner-spin-button {
} }
.query-document-detail-list { .query-document-detail-list {
overflow-x: hidden;
height: 100%; height: 100%;
} }
.query-table-clause-container { .query-table-clause-container {

View File

@ -10,7 +10,7 @@ import {
SelectionMode, SelectionMode,
Spinner, Spinner,
SpinnerSize, SpinnerSize,
Text, Text
} from "@fluentui/react"; } from "@fluentui/react";
import * as ko from "knockout"; import * as ko from "knockout";
import React, { Component } from "react"; import React, { Component } from "react";
@ -54,7 +54,7 @@ import {
IDocument, IDocument,
IQueryTableRowsType, IQueryTableRowsType,
IQueryTablesTabComponentProps, IQueryTablesTabComponentProps,
IQueryTablesTabComponentStates, IQueryTablesTabComponentStates
} from "./QueryTableTabUtils"; } from "./QueryTableTabUtils";
export interface Button { export interface Button {
@ -114,8 +114,8 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
selectedQueryText: selectedQueryText:
userContext.apiType === "Cassandra" userContext.apiType === "Cassandra"
? `SELECT * FROM ${getQuotedCqlIdentifier( ? `SELECT * FROM ${getQuotedCqlIdentifier(
this.props.queryTablesTab.collection.databaseId this.props.queryTablesTab.collection.databaseId
)}.${getQuotedCqlIdentifier(this.props.queryTablesTab.collection.id())}` )}.${getQuotedCqlIdentifier(this.props.queryTablesTab.collection.id())}`
: "Select * from c", : "Select * from c",
isHelperActive: true, isHelperActive: true,
executeQueryButton: { executeQueryButton: {
@ -224,10 +224,6 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
let selectedItems: Entities.ITableEntity[]; let selectedItems: Entities.ITableEntity[];
const { selection } = this.state; const { selection } = this.state;
isFirstItemSelected && selection.setIndexSelected(0, true, false); isFirstItemSelected && selection.setIndexSelected(0, true, false);
console.log(
"🚀 ~ file: QueryTablesTabComponent.tsx ~ line 254 ~ QueryTablesTabComponent ~ selection.getSelection().length",
selection.getSelection().length
);
if (selection.getSelection().length > 0) { if (selection.getSelection().length > 0) {
Object.keys(this.state.selection.getSelection()[0]).map((key, index) => { Object.keys(this.state.selection.getSelection()[0]).map((key, index) => {
if (key === documentKey) { if (key === documentKey) {
@ -295,7 +291,7 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
} }
public async loadEntities(isInitialLoad: boolean): Promise<void> { public async loadEntities(isInitialLoad: boolean): Promise<void> {
const { tableEntityListViewModel, selectedQueryText } = this.state; const { selectedQueryText } = this.state;
// tableEntityListViewModel.renderNextPageAndupdateCache(); // tableEntityListViewModel.renderNextPageAndupdateCache();
let headers: string[] = []; let headers: string[] = [];
//eslint-disable-next-line //eslint-disable-next-line
@ -307,6 +303,7 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
selectedQueryText, selectedQueryText,
true true
); );
headers = this.getFormattedHeaders(documents.Results); headers = this.getFormattedHeaders(documents.Results);
this.setupIntialEntities(documents.Results, headers, isInitialLoad); this.setupIntialEntities(documents.Results, headers, isInitialLoad);
} else { } else {
@ -336,6 +333,8 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
isInitialLoad: boolean isInitialLoad: boolean
): void => { ): void => {
this.columns = []; this.columns = [];
const { queryTableRows } = this.state;
headers.map((header) => { headers.map((header) => {
this.columns.push({ this.columns.push({
key: header, key: header,
@ -354,9 +353,15 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
}); });
const documentItems = this.generateDetailsList(entities); const documentItems = this.generateDetailsList(entities);
const filteredItems = documentItems.slice(0, PAGESIZE); const filteredItems = documentItems.slice(0, PAGESIZE);
const queryTableRowsClone = [...queryTableRows];
const updatedQueryTableRows = queryTableRowsClone.map((queryTableRow) => {
const queryTableRowClone = { ...queryTableRow };
queryTableRowClone.fieldOptions = getformattedOptions(headers);
return queryTableRowClone;
});
this.setState( this.setState(
{ {
columns: this.columns, columns: this.columns,
@ -369,6 +374,7 @@ class QueryTablesTabComponent extends Component<IQueryTablesTabComponentProps, I
queryText: this.state.queryViewModel.queryText(), queryText: this.state.queryViewModel.queryText(),
fromDocument: 0, fromDocument: 0,
toDocument: PAGESIZE, toDocument: PAGESIZE,
queryTableRows: updatedQueryTableRows,
}, },
() => { () => {
if (isInitialLoad && headers.length > 0) { if (isInitialLoad && headers.length > 0) {