-
5 Jul 2012 1:19 AM #1
Ext.picker.Date updateDayText
Ext.picker.Date updateDayText
Hi,
either I did not understand how to use the updateDayText method or it simply never worked.
Here is my override:
Code:/** * @author: Torsten Dinkheller (Mobile Game Design e.K., Germany) * * Updates the methods for the dayText, monthText, yearText */ Ext.define('App.override.picker.Date', { override: 'Ext.picker.Date', /** * Updates the monthText configuration */ updateMonthText: function(newMonthText, oldMonthText) { this.updateDateText(newMonthText, oldMonthText); }, /** * Updates the dayText configuraton */ updateDayText: function(newDayText, oldDayText) { this.updateDateText(newDayText, oldDayText) }, /** * Updates the yearText configuration */ updateYearText: function(newYearText, oldYearText) { this.updateDateText(newYearText, oldYearText); }, /** * Updates the Text configuration for day, month, year */ updateDateText: function(newText, oldText) { var innerItems = this.getInnerItems(), ln = innerItems.length, item, i; //loop through each of the current items and set the title on the correct slice if (this.initialized) { for (i = 0; i < ln; i++) { item = innerItems[i]; if ((typeof item.getTitle() == "string" && item.getTitle() == oldText) || (item.getTitle().getHtml() == oldText)) { item.setTitle(newText); } } } } });
-
5 Jul 2012 5:07 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
And how are using it?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Jul 2012 7:02 AM #3
how to use it
how to use it
First of it already was in the Date.js, I just fixed it, as it did not work before.
Here is an example on how to use it:
Controller:
Code:config: { refs: { desiredDatePicker: 'datepicker' }, control: { desiredDatePicker: { show: function(){ this.getDesiredDatePicker().updateDayText('Tag', 'Day'); }, } } }
-
5 Jul 2012 8:58 AM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
You aren't understanding the whole concept of the configs. Each config within the config object will get a getter and setter method created. The getter will simply return the value of the property the setter however does more than just sets the property. When the setter method is executed it first looks to see if there is an applier method. If there is it will execute that applier method that can transform the value into something and returns that. It then sets the property. Then it will see if there is an updater method, if there is then it will execute that updater method. The updateDayText is an updater method so you shouldn't really call it but call it's setter method.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Jul 2012 12:01 PM #5
Getter and Setter
Getter and Setter
So, what you are saying is, that the original works:
So the first line -Code:/** * Updates the monthText configuration */ updateMonthText: function(newMonthText, oldMonthText) { var innerItems = this.getInnerItems, ln = innerItems.length, item, i; ...
this.getInnerItems
- works without brackets?
Why is it this.getInnerItems and not this.getInnerItems()?
-
5 Jul 2012 12:58 PM #6Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,624
- Vote Rating
- 434
No, I'm saying you shouldn't execute updateMonthText but execute setMonthText instead and that setter will then execute updateMonthText for you.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
5 Jul 2012 11:30 PM #7
. When you asked me for an example on how to use it, I had to come up with an example.
So I gave that example to you.
Usually I am only using 'get' and 'set' so this seems to be a big misunderstanding.
Anyways thanks for sharing the knowledge so that I know now why to only use the get and set and you helped me finding the right code example, which should have been:
right?Code:config: { refs: { desiredDatePicker: 'datepicker' }, control: { desiredDatePicker: { show: function(){ // set 'Tag' which is the German word for 'day' this.getDesiredDatePicker().setDayText('Tag'); }, } } }
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote