Hi,
I'am using SGWT Pro 12.0 released July 30, 2018.
My code with the old version worked but now I have this exception in browser console
On my DataSource (searchFieldData ) I add a custom Operator for Search. This is only for the date/datetime fields
I note that defaultOperators is empty and in the browse console there is the exception above!
If I modify the code with
The istruction :
searchFieldData.getFieldOperators(fieldName);
generates an exception..
Can you help me?
Thanks a lot.
I'am using SGWT Pro 12.0 released July 30, 2018.
My code with the old version worked but now I have this exception in browser console
Code:
Uncaught TypeError: Cannot read property 'contains' of null at _3.isc_FilterClause_updateOperatorDefault [as updateOperatorDefault] (ISC_DataBinding.js?plin_version=12.0p_2018-07-30:2981) at _3.isc_FilterClause_updateFields [as updateFields] (ISC_DataBinding.js?plin_version=12.0p_2018-07-30:2981) at _3.isc_FilterClause_fieldNameChanged [as fieldNameChanged] (ISC_DataBinding.js?plin_version=12.0p_2018-07-30:2977) at _3.isc_c_Class_invokeSuper [as invokeSuper] (ISC_Core.js?plin_version=12.0p_2018-07-30:312) at _3.isc_c_Class_Super [as Super] (ISC_Core.js?plin_version=12.0p_2018-07-30:304) at _3.fieldNameChanged (ISC_DataBinding.js?plin_version=12.0p_2018-07-30:3024) at _3.changed (ISC_DataBinding.js?plin_version=12.0p_2018-07-30:3002) at _3.isc_FormItem_handleChanged [as handleChanged] (ISC_Forms.js?plin_version=12.0p_2018-07-30:1204) at _3.isc_FormItem_storeValue [as storeValue] (ISC_Forms.js?plin_version=12.0p_2018-07-30:1203) at _3.isc_FormItem__updateValue [as $10y] (ISC_Forms.js?plin_version=12.0p_2018-07-30:1200) at _3.isc_SelectItem_updateValue [as updateValue] (ISC_Forms.js?plin_version=12.0p_2018-07-30:2288) at _3.isc_SelectItem_changeToValue [as changeToValue] (ISC_Forms.js?plin_version=12.0p_2018-07-30:2279) at _3.isc_SelectItem_pickValue [as pickValue] (ISC_Forms.js?plin_version=12.0p_2018-07-30:2323) at _3.itemClick (ISC_Forms.js?plin_version=12.0p_2018-07-30:2003) at _3.recordClick (ISC_Forms.js?plin_version=12.0p_2018-07-30:1996) at _3.isc_ListGrid_rowClick [as rowClick] (ISC_Grids.js?plin_version=12.0p_2018-07-30:1623) at _3.isc_c_Class_invokeSuper [as invokeSuper] (ISC_Core.js?plin_version=12.0p_2018-07-30:312) at _3.isc_c_Class_Super [as Super] (ISC_Core.js?plin_version=12.0p_2018-07-30:304) at _3.rowClick (ISC_Forms.js?plin_version=12.0p_2018-07-30:1991) at _3.eval [as rowClick] (eval at isc__makeFunction (ISC_Core.js?plin_version=12.0p_2018-07-30:82), <anonymous>:4:115) at _3.isc_GridRenderer__rowClick [as $29y] (ISC_Grids.js?plin_version=12.0p_2018-07-30:569) at _3.isc_c_Class_invokeSuper [as invokeSuper] (ISC_Core.js?plin_version=12.0p_2018-07-30:312) at _3.isc_c_Class_Super [as Super] (ISC_Core.js?plin_version=12.0p_2018-07-30:304) at _3.isc_GridBody__rowClick [as $29y] (ISC_Grids.js?plin_version=12.0p_2018-07-30:638) at _3.isc_GridRenderer_click [as click] (ISC_Grids.js?plin_version=12.0p_2018-07-30:567) at _3.isc_Canvas_handleClick [as handleClick] (ISC_Core.js?plin_version=12.0p_2018-07-30:3494) at _3.isc_c_EventHandler_bubbleEvent [as bubbleEvent] (ISC_Core.js?plin_version=12.0p_2018-07-30:2130) at _3.isc_c_EventHandler_handleClick [as handleClick] (ISC_Core.js?plin_version=12.0p_2018-07-30:1972) at _3.isc_c_EventHandler__handleMouseUp [as $k5] (ISC_Core.js?plin_version=12.0p_2018-07-30:1957) at _3.isc_c_EventHandler_handleMouseUp [as handleMouseUp] (ISC_Core.js?plin_version=12.0p_2018-07-30:1948) at _3.isc_c_EventHandler_dispatch [as dispatch] (ISC_Core.js?plin_version=12.0p_2018-07-30:2217) at HTMLDocument.eval (eval at isc__makeFunction (ISC_Core.js?plin_version=12.0p_2018-07-30:82), <anonymous>:3:123)
Code:
OperatorId[] operatorValid = new OperatorId[] { OperatorId.EQUALS, OperatorId.NOT_EQUAL, OperatorId.LESS_THAN, OperatorId.GREATER_THAN, OperatorId.LESS_OR_EQUAL, OperatorId.GREATER_OR_EQUAL, OperatorId.NOT_BLANK, OperatorId.IS_BLANK,OperatorId.IS_NULL,OperatorId.NOT_NULL}; searchFieldData.setTypeOperators(FieldType.DATE, operatorValid); searchFieldData.setTypeOperators(FieldType.DATETIME, operatorValid); Operator newOperator=new Operator(); newOperator.setTitle("mese corrente"); newOperator.setID("mese_corrente"); newOperator.setValueType(OperatorValueType.NONE); searchFieldData.addSearchOperator(newOperator, new FieldType[]{FieldType.DATE,FieldType.DATETIME}); FilterBuilder filterBuilder = new FilterBuilder(); filterBuilder.setDataSource(searchFieldData); filterBuilder.setFieldOperatorCustomizer(new FieldOperatorCustomizer() { @Override public OperatorId[] getFieldOperators(String fieldName, OperatorId[] defaultOperators, FilterBuilder filterBuilder) { DataSource ds = filterBuilder.getDataSource(); DataSourceField field = ds.getField(fieldName); if(field.getType().equals(FieldType.DATE) || field.getType().equals(FieldType.DATETIME)){ return defaultOperators; } ........ ...................... } });
If I modify the code with
Code:
filterBuilder.setFieldOperatorCustomizer(new FieldOperatorCustomizer() { @Override public OperatorId[] getFieldOperators(String fieldName, OperatorId[] defaultOperators, FilterBuilder filterBuilder) { DataSource ds = filterBuilder.getDataSource(); DataSourceField field = ds.getField(fieldName); if(field.getType().equals(FieldType.DATE) || field.getType().equals(FieldType.DATETIME)){ OperatorId[] defaultOperatorsDate = searchFieldData.getFieldOperators(fieldName); return defaultOperatorsDate; } ...................... } });
searchFieldData.getFieldOperators(fieldName);
generates an exception..
Can you help me?
Thanks a lot.
Comment