May 20, 2013, 8:42 AM
Date Range in a user control
I have a user control contain date range input and define as below
The problem is "end" is undefined.
I found that field.endDateField = "App.dtrDoc_dtpDteTo".
If I run Ext.getCmp("dtrDoc_dtpDteTo") in Immediate Window, I can get the component.
However Ext.getCmp("App.dtrDoc_dtpDteTo") get undefined.
Actually I try some alternate method in the demo
https://examples2.ext.net/#/Form/Dat...From-To_Range/
First I add a new web from in my project and just copy the code into it. It runs fine.
Then I change it to a user control and insert it to the same place of my date range, same problem occurred.
It seems that the ClientID of the control in user control have a prefix of "App.", but in JS part this "App." should be remove for Ext.getCmp().
Can anyone help? Thanks!
...
<ext:Panel ID="pnlFrom" runat="server" Layout="FormLayout" ColumnWidth="0.30">
<Items>
<ext:DateField ID="dtpDteFr" runat="server" Vtype="daterange" EnableKeyEvents="true">
<Listeners>
<Render Handler="this.endDateField = '#{dtpDteTo}'" />
</Listeners>
</ext:DateField>
</Items>
</ext:Panel>
...
<ext:Panel ID="pnlTo" runat="server" Layout="FormLayout" ColumnWidth="0.30">
<Items>
<ext:DateField ID="dtpDteTo" runat="server" Vtype="daterange" EnableKeyEvents="true">
<Listeners>
<Render Handler="this.startDateField = '#{dtpDteFr}'" />
</Listeners>
</ext:DateField>
</Items>
</ext:Panel>
...
During running it have error in the JS part.var end=Ext.getCmp(field.endDateField);
this.dateRangeMin=date;
end.setMinValue(date); <== program broke at here
This JS seems auto-gen by ext.net. When when I remove the setting of endDateField and startDateField, the problem disappear.The problem is "end" is undefined.
I found that field.endDateField = "App.dtrDoc_dtpDteTo".
If I run Ext.getCmp("dtrDoc_dtpDteTo") in Immediate Window, I can get the component.
However Ext.getCmp("App.dtrDoc_dtpDteTo") get undefined.
Actually I try some alternate method in the demo
https://examples2.ext.net/#/Form/Dat...From-To_Range/
First I add a new web from in my project and just copy the code into it. It runs fine.
Then I change it to a user control and insert it to the same place of my date range, same problem occurred.
It seems that the ClientID of the control in user control have a prefix of "App.", but in JS part this "App." should be remove for Ext.getCmp().
Can anyone help? Thanks!