on 06-27-2023 11:50 AM
Hi Expert,
I am facing issue with Date Picker. Detail below:
Main.view.xml:
<mvc:View controllerName="com.bsci.magia.bomanalysis.controller.Main"
xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m" xmlns:smartFilterBar="sap.ui.comp.smartfilterbar" xmlns:smartTable="sap.ui.comp.smarttable" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:app="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" class="sapUiSizeCompact" xmlns:ui="sap.ui.table" height="100%">
<Page id="page" title="{i18n>title}" titleAlignment="Center" showHeader="true" showNavButton="true" class="sapUiSizeCompact">
<content>
<RadioButtonGroup id="radioButtonGrp" columns="8" valueState="None" width="1230.5px" editable="true" enabled="true" textDirection="Inherit" class="sapUiResponsiveMargin" select="onRadioButtonGroupSelect"> <buttons>
<RadioButton id="idRBTD" text="Top Down" editable="true" enabled="true" visible="true" width="auto" valueState="None" selected="false"/>
<RadioButton id="idRBBU" text="Bottom Up" editable="true" enabled="true" visible="true" width="auto" valueState="None" selected="false"/>
</buttons>
</RadioButtonGroup>
<VBox id="_IDGenVBox1" fitContainer="true">
<smartFilterBar:SmartFilterBar id="smartFilterBar" showMessages="false" visible="true" entitySet="TopDownItemSet" enableBasicSearch="false" basicSearchFieldName="Plant,Product,Usage,ValidFromDate,ValidToDate,ReqdQty,ExclusiveComponents" useDateRangeType="true">
<smartFilterBar:controlConfiguration>
<smartFilterBar:ControlConfiguration id="idForPlantFilter" key="Plant" label="Plant" visibleInAdvancedArea="true" visible="true" index="3"></smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration id="idForProductFilter" key="Product" mandatory="mandatory" label="Product" filterType="auto" visibleInAdvancedArea="true" visible="true" index="2"></smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration id="idForValidFromDateFilter" key="ValidFromDate" label="Valid From Date" visibleInAdvancedArea="true" visible="true" index="5">
<smartFilterBar:customControl>
<DatePicker id="fromDate" valueFormat="MM-dd-yyyy" class="sapUiSmallMarginBottom"/> </smartFilterBar:customControl>
</smartFilterBar:ControlConfiguration>
<smartFilterBar:ControlConfiguration id="idForReqdQtyFilter" key="ReqdQty" filterType="single" label="Quantity" visibleInAdvancedArea="true" visible="true" index="7"></smartFilterBar:ControlConfiguration> <smartFilterBar:ControlConfiguration id="idForUsageFilter" key="Usage" label="Usage" visibleInAdvancedArea="true" visible="true" index="8"></smartFilterBar:ControlConfiguration> <smartFilterBar:ControlConfiguration id="idForExcluCompFilter" key="ExclusiveComponents" controlType="auto" label="Exclusive Components" visibleInAdvancedArea="true" visible="false" index="9"> <smartFilterBar:customControl>
<CheckBox id="exCmpCB" text="Exclusive Components" selected="false" />
</smartFilterBar:customControl>
</smartFilterBar:ControlConfiguration>
</smartFilterBar:controlConfiguration>
</smartFilterBar:SmartFilterBar>
<smartTable:SmartTable beforeRebindTable='onBeforeRebindTableSummary' visible="true" id="LineItemsSmartTable" initiallyVisibleFields="Level,Nofitem,ComponentNo,ComponentDescription,BaseQty,BaseUom,ReqdQty,Plant,Usage,AltBom,Revision,Quantity,Uom,Scrap,ScrapQty,PhantomPart,AlternativeItem,Spk,PlantSpMatlStatus,Product,ProductDescription,ValidFromDate,ValidToDate" entitySet="TopDownItemSet" smartFilterId="smartFilterBar" tableType="Table" useExportToExcel="true" beforeExport="onBeforeExport" useVariantManagement="true" useTablePersonalisation="true" showRowCount="false" persistencyKey="SmartTableAnalytical_Explored" enableAutoBinding="true" class="sapUiResponsiveContentPadding" enableAutoColumnWidth="true" editTogglable="false" app:useSmartToggle="false">
<smartTable:layoutData>
<FlexItemData id="_IDGenFlexItemData1" growFactor="1" baseSize="0%"/>
</smartTable:layoutData>
</smartTable:SmartTable>
</VBox>
</content>
</Page>
</mvc:View>
Controller code where setting date:in onInit function:
onInit: function () { var dateFormat = sap.ui.core.format.DateFormat.getDateInstance({ pattern: "MM-dd-yyyy" }); var todayDate = new Date(); var fromDate = dateFormat.format(todayDate); this.getView().byId("fromDate").setDateValue(new Date()); // this.getView().byId("fromDate").setValue(fromDate); },tried setValue() as well.manifest.json:
Screen Output (filter bar not generating):
Error that is getting logged in console :
The error is coming from DateRangeType-dbg.js which is standard library code for date picker. Not sure on how to fix this.
Please help here.
Hello Gaurav,
The reason for the error is due to conflicting configurations in the SmartFilterBar. The useDateRange property of the SmartFilterBar is set to true, which converts all date fields into DynamicDateRange controls. However, you also have a control configuration that adds a custom control to certain date fields.
As a result, the SmartFilterBar becomes confused and attempts to initialize the DynamicDateRange control, but it is already replaced by the custom DatePicker. This conflict leads to the exception being thrown.
To resolve this issue, I recommend one of the following solutions:
1. Remove the useDateRange property, as its default value is false. This will eliminate the conflicting configuration and may resolve the error.
2. Alternatively, consider removing the custom DatePicker. By doing so, the conflicting configuration will also be removed, and the application should start working correctly.
I hope this explanation helps you to fix the issue.
Best regards,
Adrian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
11 | |
10 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.