Changing the sorting buttons

This commit is contained in:
ShimaginAndrey 2021-06-24 18:18:38 +03:00
parent 164e2c7815
commit 21b385dcd1
3 changed files with 21 additions and 11 deletions

View file

@ -412,6 +412,8 @@
"textInvalidRange": "Invalid cells range",
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"textFilterOptions": "Filter Options",
"txtSortLow2High": "Sort Lowest to Highest",
"txtSortHigh2Low": "Sort Highest to Lowest",
"textClearFilter": "Clear Filter",
"textDeleteFilter": "Delete Filter",
"textSelectAll": "Select All",

View file

@ -10,7 +10,8 @@ const FilterOptionsController = () => {
const [configFilter, setConfig] = useState(null);
const [listVal, setListValue] = useState([]);
const [isValid, setIsValid] = useState(null)
const [isValid, setIsValid] = useState(null);
const [checkSort, setCheckSort] = useState(null);
useEffect(() => {
function onDocumentReady() {
@ -36,6 +37,9 @@ const FilterOptionsController = () => {
setConfig(config);
setClearDisable(config);
const sort = config.asc_getSortState();
sort == Asc.c_oAscSortOptions.Ascending ? setCheckSort(true) : setCheckSort(false);
if (Device.phone) {
f7.sheet.open('.picker__sheet');
} else {
@ -128,7 +132,7 @@ const FilterOptionsController = () => {
};
return (
<FilterView onSort={onSort} listVal={listVal} isValid={isValid} onUpdateCell={onUpdateCell}
<FilterView onSort={onSort} listVal={listVal} checkSort={checkSort} isValid={isValid} onUpdateCell={onUpdateCell}
onDeleteFilter={onDeleteFilter} onClearFilter={onClearFilter}/>
)
};

View file

@ -6,6 +6,7 @@ import { Device } from '../../../../common/mobile/utils/device';
const FilterOptions = (props) => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const isAndroid = Device.android;
useEffect(() => {
const is_all_checked = props.listVal.every(item => item.check);
@ -33,15 +34,18 @@ const FilterOptions = (props) => {
}
</Navbar>
<List>
<ListItem className='buttons'>
<Row>
<a className='button' onClick={() => props.onSort('sortdown')}>
<Icon slot="media" icon="sortdown" />
</a>
<a className='button' onClick={() => props.onSort('sortup')}>
<Icon slot="media" icon="sortup" />
</a>
</Row>
<ListItem name='radio-button' title={_t.txtSortLow2High} radio checked={props.checkSort || ''} onClick={() => props.onSort('sortdown')}
after={isAndroid ? <Icon slot="media" icon="sortdown"></Icon> : null}>
{!isAndroid ?
<Icon slot="media" icon="sortdown"></Icon> : null
}
</ListItem>
<ListItem name='radio-button' title={_t.txtSortHigh2Low} radio checked={props.checkSort ? false : true} onClick={() => props.onSort('sortup')}
after={isAndroid ? <Icon slot="media" icon="sortup"></Icon> : null}>
{!isAndroid ?
<Icon slot="media" icon="sortup"></Icon> : null
}
</ListItem>
</List>
<List >