fix: added dataManager in filterRows function
This commit is contained in:
parent
6d29880fb7
commit
50b44bfb09
@ -427,7 +427,7 @@ export default class DataManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filterRows(filters) {
|
filterRows(filters) {
|
||||||
return this.options.filterRows(this.rows, filters)
|
return this.options.filterRows(this.rows, filters, this)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
result = this.getAllRowIndices();
|
result = this.getAllRowIndices();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { isNumber, stripHTML } from './utils';
|
import { isNumber, stripHTML } from './utils';
|
||||||
import CellManager from './cellmanager';
|
import CellManager from './cellmanager';
|
||||||
|
|
||||||
export default function filterRows(rows, filters) {
|
export default function filterRows(rows, filters, data) {
|
||||||
let filteredRowIndices = [];
|
let filteredRowIndices = [];
|
||||||
|
|
||||||
if (Object.keys(filters).length === 0) {
|
if (Object.keys(filters).length === 0) {
|
||||||
@ -18,7 +18,7 @@ export default function filterRows(rows, filters) {
|
|||||||
const cells = filteredRows.map(row => row[colIndex]);
|
const cells = filteredRows.map(row => row[colIndex]);
|
||||||
|
|
||||||
let filter = guessFilter(keyword);
|
let filter = guessFilter(keyword);
|
||||||
let filterMethod = getFilterMethod(rows, filter);
|
let filterMethod = getFilterMethod(rows, filter, data);
|
||||||
|
|
||||||
if (filterMethod) {
|
if (filterMethod) {
|
||||||
filteredRowIndices = filterMethod(filter.text, cells);
|
filteredRowIndices = filterMethod(filter.text, cells);
|
||||||
@ -30,9 +30,10 @@ export default function filterRows(rows, filters) {
|
|||||||
return filteredRowIndices;
|
return filteredRowIndices;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getFilterMethod(rows, filter) {
|
function getFilterMethod(rows, filter, data) {
|
||||||
const getFormattedValue = cell => {
|
const getFormattedValue = cell => {
|
||||||
let formatter = CellManager.getCustomCellFormatter(cell);
|
let formatter = CellManager.getCustomCellFormatter(cell);
|
||||||
|
data
|
||||||
if (formatter && cell.content) {
|
if (formatter && cell.content) {
|
||||||
cell.html = formatter(cell.content, rows[cell.rowIndex], cell.column, rows[cell.rowIndex], filter);
|
cell.html = formatter(cell.content, rows[cell.rowIndex], cell.column, rows[cell.rowIndex], filter);
|
||||||
return stripHTML(cell.html);
|
return stripHTML(cell.html);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user