add filter summary text
This commit is contained in:
@@ -56,7 +56,7 @@ function FilterColumn({ columns }) {
|
||||
|
||||
const initialValues = columns.reduce((acc, column) => {
|
||||
if (column.enableColumnFilter) {
|
||||
const filter = settingStore?.[userId]?.[pageName]?.[tableName]?.['filters'].find((filter) => filter.id === column.id);
|
||||
const filter = settingStore?.[userId]?.[pageName]?.[tableName]?.['filters']?.find((filter) => filter.id === column.id);
|
||||
if (column.filterFn === 'betweenNum' || column.filterFn === 'betweenDate') {
|
||||
acc[column.id] = filter?.value || ["", ""];
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export const TableSettingProvider = ({children}) => {
|
||||
const SummaryTextMessage = (values, columns) => {
|
||||
let SummaryText = "";
|
||||
let HideText = "";
|
||||
let FilterText;
|
||||
let FilterText = "";
|
||||
let SortText = "";
|
||||
|
||||
if (values.sorts && values.sorts.length > 0) {
|
||||
@@ -67,7 +67,17 @@ export const TableSettingProvider = ({children}) => {
|
||||
_list.push(`${_column.header}` + `(${sort.desc ? "نزولی" : "صعودی"})`)
|
||||
}
|
||||
if (_list.length > 0)
|
||||
SortText = " مرتب شده بر اساس " + _list.join(", ")
|
||||
SortText = " مرتب شده بر اساس : " + _list.join(", ")
|
||||
}
|
||||
if (values.filters && values.filters.length > 0){
|
||||
const _list = []
|
||||
for (const filter of values.filters){
|
||||
const _column = columns.find(column => column.id == filter.id)
|
||||
_list.push(`${_column.header}`)
|
||||
}
|
||||
console.log(_list)
|
||||
if (_list.length > 0)
|
||||
FilterText = " فیلتر شده بر اساس : " + _list.join(", ")
|
||||
}
|
||||
|
||||
if (values.hides) {
|
||||
@@ -84,15 +94,24 @@ export const TableSettingProvider = ({children}) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (HideText || SortText) {
|
||||
if (HideText || SortText || FilterText) {
|
||||
if (SortText) {
|
||||
SummaryText += SortText;
|
||||
if (HideText) {
|
||||
SummaryText += " ; ";
|
||||
}
|
||||
if (FilterText){
|
||||
SummaryText += " ; ";
|
||||
}
|
||||
}
|
||||
if (HideText) {
|
||||
SummaryText += HideText;
|
||||
if (FilterText) {
|
||||
SummaryText += " ; ";
|
||||
}
|
||||
}
|
||||
if (FilterText){
|
||||
SummaryText += FilterText
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user