fix: change category not default select sub categories

This commit is contained in:
caturbgs 2021-12-22 11:01:48 +07:00
parent 9cefac57ae
commit a89566adc1
2 changed files with 7 additions and 9 deletions

View File

@ -71,12 +71,9 @@ export const Product = observer(() => {
<Select <Select
placeholder={"Select Sub Category"} placeholder={"Select Sub Category"}
allowClear={true} allowClear={true}
onChange={(val) => { onChange={(val) => handleChangeSubcategory(val)}
if (val) {
handleChangeSubcategory(val);
}
}}
style={{marginBottom: "10px", width: "100%"}} style={{marginBottom: "10px", width: "100%"}}
value={store.transaction.filterSubCategory}
> >
{store.transaction.dataSubCategories.map((item, index) => ( {store.transaction.dataSubCategories.map((item, index) => (
<Option key={item.id} value={item.id}> <Option key={item.id} value={item.id}>

View File

@ -34,9 +34,10 @@ export const Transaction = observer(() => {
}, []); }, []);
const handleChangeTabs = async (key) => { const handleChangeTabs = async (key) => {
modalLoader.setLoading(true);
store.transaction.dataSubCategories = []; store.transaction.dataSubCategories = [];
store.transaction.data = []; store.transaction.data = [];
modalLoader.setLoading(true); store.transaction.filterSubCategory = null;
store.transaction.filterCategory = key; store.transaction.filterCategory = key;
await store.transaction.getDataSubCategories(); await store.transaction.getDataSubCategories();
modalLoader.setLoading(false); modalLoader.setLoading(false);