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", "textInvalidRange": "Invalid cells range",
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"", "txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"textFilterOptions": "Filter Options", "textFilterOptions": "Filter Options",
"txtSortLow2High": "Sort Lowest to Highest",
"txtSortHigh2Low": "Sort Highest to Lowest",
"textClearFilter": "Clear Filter", "textClearFilter": "Clear Filter",
"textDeleteFilter": "Delete Filter", "textDeleteFilter": "Delete Filter",
"textSelectAll": "Select All", "textSelectAll": "Select All",

View file

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

View file

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