Hi,
I'm trying to use setVisibleWhen() functionality instead of other workarounds in my app. But I've come to massive performance problems.
In my test case I've got a DataSource with around 20 fields and most of them have conditions setVisibleWhen() or setReadOnlyWhen().
Now with ListGrid and connected DynamicForm switching between records can lead to delays even to couple of seconds. Without these conditions it works fine.
I've been trying to isolate a problem to simple test case. First problem that I've encountered is multiple rule checking - test with logging set to INFO on ruleEngine and whenRules.
Here's my test case:
In above example on start we've got these messages:
With just one click on record we've got another messages;
It looks like there are multiple checks of this condition. In my base case there are around 100+ messages and chrome console can hang on this.
I'm assuming it's not desired??
Tested also on latest nightly from 2023-06-29.
Best regards
Mariusz Goch
PS:
As you can see in this example I'm using DataSourceTextField instead of DataSourceEnumField. It's because warning previously reported:
https://forums.smartclient.com/forum...ation-warnings
But switching do DataSourceEnumField it makes things even worse - probably due to this warnings.
I'm trying to use setVisibleWhen() functionality instead of other workarounds in my app. But I've come to massive performance problems.
In my test case I've got a DataSource with around 20 fields and most of them have conditions setVisibleWhen() or setReadOnlyWhen().
Now with ListGrid and connected DynamicForm switching between records can lead to delays even to couple of seconds. Without these conditions it works fine.
I've been trying to isolate a problem to simple test case. First problem that I've encountered is multiple rule checking - test with logging set to INFO on ruleEngine and whenRules.
Here's my test case:
Code:
DataSource ds = new DataSource(); ds.setClientOnly(true); DataSourceIntegerField fieldId = new DataSourceIntegerField("id"); fieldId.setPrimaryKey(true); ds.addField(fieldId); ds.addField(new DataSourceTextField("field1")); ds.addField(new DataSourceTextField("field2")); DataSourceTextField fieldStatus = new DataSourceTextField("status"); fieldStatus.setValueMap("new", "progress", "finished", "canceled"); ds.addField(fieldStatus); Record r1 = new Record(); r1.setAttribute("id", 1); r1.setAttribute("field1", "Field 1"); r1.setAttribute("status", "new"); Record r2 = new Record(); r2.setAttribute("id", 2); r2.setAttribute("field1", "Field 2"); r2.setAttribute("status", "finished"); ds.setTestData(r1, r2); HLayout layout = new HLayout(8); ListGrid listGrid = new ListGrid(); listGrid.setDataSource(ds); listGrid.setWidth(300); listGrid.setHeight(300); listGrid.fetchData(); layout.addMember(listGrid); DynamicForm form = new DynamicForm(); form.setDataSource(ds); TextItem itemField1 = new TextItem("field1"); // itemField1.setReadOnlyWhen(new AdvancedCriteria("status", OperatorId.IN_SET, new String[] {"finished", "canceled"})); itemField1.setVisibleWhen(new AdvancedCriteria("status", OperatorId.IN_SET, new String[] {"finished", "canceled"})); ButtonItem itemAdd = new ButtonItem("New"); itemAdd.addClickHandler(event -> { form.editNewRecord(); }); form.setFields( new TextItem("id"), itemField1, new TextItem("field2"), new SelectItem("status"), new SubmitItem(), itemAdd ); layout.addMember(form); listGrid.addRecordClickHandler(event -> { form.editRecord(event.getRecord()); }); this.addChild(layout);
Code:
20:53:09.797:TMR7:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:09.798:TMR7:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:09.808:TMR8:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:09.808:TMR8:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:09.809:TMR8:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:09.809:TMR8:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:09.810:TMR8:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:09.810:TMR8:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:09.810:TMR8:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:09.810:TMR8:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:09.811:TMR8:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:09.811:TMR8:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:09.812:TMR8:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:09.812:TMR8:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4'
Code:
20:53:58.843:MDN2:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result null 20:53:58.843:MDN2:INFO:whenRules:Hide FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.917:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.917:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.918:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.918:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.919:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.919:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.920:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.920:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.921:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.921:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.922:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.922:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.923:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.923:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.924:MUP5:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.924:MUP5:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.931:TMR7:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.932:TMR7:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.932:TMR7:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.932:TMR7:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.933:TMR7:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.933:TMR7:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4' 20:53:58.934:TMR7:INFO:whenRules:isc_RulesEngine_0:Applying visibility rule 'isc_DynamicForm_1_field1_visibility' for FormItem isc_DynamicForm_1.field1 with action result true 20:53:58.934:TMR7:INFO:whenRules:Show FormItem 'isc_DynamicForm_1.isc_TextItem_4'
I'm assuming it's not desired??
Tested also on latest nightly from 2023-06-29.
Best regards
Mariusz Goch
PS:
As you can see in this example I'm using DataSourceTextField instead of DataSourceEnumField. It's because warning previously reported:
https://forums.smartclient.com/forum...ation-warnings
But switching do DataSourceEnumField it makes things even worse - probably due to this warnings.
Comment