Posted in: SPARK UI Toolkit Controls
Andrzej PaslawskiJuly 16, 2016 at 3:30 am #2323
I’m trying to test the DatePicker with the keyboard, and I can see some inconsistency.
(Initial control value: “2016-07-14”)
1. Tab into date control, insert: 2001, click Tab (control value “2001-01-01”)
2. Remove the value using Backspace, insert 2002, click Tab (control value “2016-07-16” = TODAY)
3. Click Shift+Tab to get back to the control, insert 2003-04 (control value “2003-04-01”)
4. Remove the value using Backspace, insert 2003-05, click Tab (control value “2016-07-16” = TODAY)
Such an inconsistent behaviour can be misleading.
1. Tab into a Date Picker control and either make a change OR NOT, then click Tab (the ‘On Day Cell Render’ is called 42 times then ‘On change’ once);
then click Tab again leaving the control (and the ‘On Day Cell Render’ is called 42 times).
Maybe this is not a big deal, but there’s sort of proliferation of method invocations. ??
2. Additionally ‘On Day Cell Render’ and ‘On change’ don’t have any context variables (like e.g. newText, oldText for Text control).
So I’m not sure what for and how the events may be used.
Can you suggest any practical examples for ‘On Day Cell Render’?
AndrzejSPARK SupportJuly 18, 2016 at 10:51 am #2324
Can you please provide some additional details on your configuration? How are you setting the initial value of the control?
I have tested a scenario with the control and I am unable to reproduce the issue that you are experiencing. When I enter the value, such as 2003-04, I click tab to complete the input, and the value changes to 2003-04-01. This value is returned successfully through the getDate() method.
For your reference, please visit the following articles on the Date Picker Control:
Stephen P.Andrzej PaslawskiJuly 25, 2016 at 3:54 am #2329
>>When I enter the value, such as 2003-04, I click tab to complete the input, and the value changes to 2003-04-01.
OK, this is a half of my scenario, now, without leaving the control remove the value using Backspace and enter 2004-05 or so.
This time you should see the value changed to the current date.
Secondly, can you comment on the ‘On Day Cell Render’ handler? See my remarks above.
AndrzejSPARK SupportJuly 25, 2016 at 8:48 am #2330
Thank you for the more detailed steps. I was able to reproduce this error this time.
I will discuss this with our Development Team and see if this is a potential bug.
Stephen P.SPARK SupportJuly 25, 2016 at 2:20 pm #2331
The issue with the second change event reverting to today’s date has been reported to Development as a bug, and will be fixed in an upcoming release.
As for the forty-two (42) calls to ‘On Day Cell Render’, this is each of the days in the calendar object being populated. The popup calendar has six weeks, which is a total of 42 days.
Stephen P.Andrzej PaslawskiJuly 26, 2016 at 12:32 am #2332
thanks for your reply.
>>As for the forty-two (42) calls …
This is what I expected. And here comes my question:
taking into account this behaviour, what is the valid or practical scenario where ‘On Day Cell Render’ handler may be used?
I was thinking about using it to somehow intercept and modify the way the date is presented in the input field.
But, unfortunately, the handler seems not to be a good candidate for this.
So let me ask you one more question, is there any way to allow the control to accept more than one date format?
Without creating my own control.
AndrzejSPARK SupportJuly 26, 2016 at 8:58 am #2336
The JS Documentation does give one limited example for the On Day Cell Render:
On Day Cell Render: Description: This event is triggered before the date shows on the control. Example: me.setDate(“01/01/2015”)
As to what the valid purpose for this event is, I might use it for formatting certain dates. Such as if me.getDate() == 12/25/2016 then me.setColorStyle(“S”).
The input field of the Date Picker does only accept one format per control. The logic will convert an input of July 26, 2016 to 7/26/2016, however it will not correct 26/07/2016 to a mm/dd/yyyy format. Best Practice would be to use the Placeholder Text under Behavior in the Configuration options to indicate to the end user which format to input for the dates.
You must be logged in to reply to this topic.