3lvis / Form

The most flexible and powerful way to build a form on iOS

Home Page:http://hyper.no

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reloadWithDictionary In Form/Source/FORMDataSource.m doesn't reloadData

ff4415 opened this issue · comments

hyperoslo@acd73cf

  • (void)reloadWithDictionary:(NSDictionary *)dictionary;

it works well but doesn't refresh View after value reloaded. I saw pr in Fix: reloadWithDictionary doesn't run targets #165 which fixed in HYPFormsCollectionViewDataSource.m .

I wonder it's same problem here in FORMDataSource.m

Hi!

Thanks for reporting this bug :) Would you mind sharing the JSON you're using with your forms and the dictionary you're using to reload the data? We need this to reproduce the bug to be able to fix it.

here is my forms.json

{
    "groups":[
        {
            "id":"domesticWater",
            "title":"建筑给水设计",
            "sections":[
                {
                    "id":"DomesticWaterCategory",
                    "fields":[
                        {
                            "id":"buildingCategory",
                            "title":"建筑类别",
                            "type":"select",
                            "size":{
                                "width":80
                            },
                            "values":[
                                {
                                    "id":"House",
                                    "title":"普通住宅",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Villa",
                                    "title":"别墅",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Dormitory",
                                    "title":"宿舍",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Motel",
                                    "title":"招待所,培训中心,普通旅馆",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Apartment",
                                    "title":"酒店式公寓",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"HotelRooms",
                                    "title":"宾馆客房",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"HospitalInpatientDepartment",
                                    "title":"医院住院部",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Beadhouse",
                                    "title":"养老院、托老所",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Kindergarten",
                                    "title":"幼儿园、托儿所",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"publicBathroom",
                                    "title":"公共浴室",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Barber",
                                    "title":"理发室、美容院",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Laundry",
                                    "title":"洗衣房",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Catering",
                                    "title":"餐饮业",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Market",
                                    "title":"商场",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Library",
                                    "title":"图书馆",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Bookstore",
                                    "title":"书店",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"OfficeBuilding",
                                    "title":"办公楼",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"ExperimentalBuilding",
                                    "title":"教学、实验楼",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Cinema",
                                    "title":"电影院、剧院",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"ConventionAndExhibitionCenter",
                                    "title":"会展中心(博物馆、展览馆)",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"FitnessCenter",
                                    "title":"健身中心",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Stadium",
                                    "title":"体育场(馆)",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"ConferenceHall",
                                    "title":"会议厅",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"PassengerStation",
                                    "title":"航站楼、客运站旅客",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"FoodMarket",
                                    "title":"菜市场地面冲洗及保鲜用水",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                },
                                {
                                    "id":"Parking",
                                    "title":"停车场地面冲洗水",
                                    "targets":[
                                        {
                                            "id":"sanitaryWareSettingStandard",
                                            "type":"field",
                                            "action":"update"
                                        }
                                    ]
                                }
                            ]
                        },
                        {
                            "id":"sanitaryWareSettingStandard",
                            "title":"卫生器具设置标准",
                            "type":"select",
                            "hidden":true,
                            "size":{
                                "width":100
                            }
                        }
                    ]
                },
                {
                    "id":"DomesticWaterQuota",
                    "fields":[
                        {
                            "id":"WaterQuota",
                            "title":"最高日生活用水定额( L / 人*每天)",
                            "type":"number",
                            "hidden":true,
                            "size":{
                                "width":100
                            }
                        },
                        {
                            "id":"HourlyVariationCoefficient",
                            "title":"小时变化系数Kh",
                            "type":"number",
                            "hidden":true,
                            "size":{
                                "width":60
                            }
                        },
                        {
                            "id":"UsingTime",
                            "title":"使用小时数h",
                            "type":"number",
                            "hidden":true,
                            "size":{
                                "width":40
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

I just want to clean target when selected item updated in buildingCategory .

here is the code in self.dataSource.fieldUpdatedBlock

 [weakSelf.dataSource reloadWithDictionary:@{@"WaterQuota":@0,
                                             @"HourlyVariationCoefficient":@0
                                                        }];

and if you look into the Demo "Basic-ObjC" which button "update" doesn't work well,

- (void)updateButtonAction {
    [self.dataSource reloadWithDictionary:@{@"first_name" : @"Hodo",
                                            @"salary_type" : @1,
                                            @"hourly_pay_level" : @1,
                                            @"hourly_pay_premium_percent" : @10,
                                            @"hourly_pay_premium_currency" : @10,
                                            @"start_date" : [NSNull null],
                                            @"username": @1}];
}

It work somehow if form 's Disabled set True,
[self.dataSource disable];

otherwise target-views doesn't refresh
it's same problem as mine.


And here's another bug

temp

if clicked it then program abort

temp1

Thanks for your work . I have learned a lot with it .Very appreciate.