calendar widget in delegate method
4 posts
• Page 1 of 1
calendar widget in delegate methodI want to get the HTML code of the calendar widget in the block__field_name_widget() in table's delegate class so it would have the same HTML output as defining the calendar in the fields.ini. How can I do that? Thanks.
Re: calendar widget in delegate methodI'm not sure I fully understand what you are trying to do. Can you explain a little more?
Re: calendar widget in delegate methodOk, I have a table with 2 columns(column_type, column_value) as following:
column_type enum('number', 'percentage', 'currency', 'date', 'text'), column_value varchar(64); The type of value of column_value depends on the value of column_type. For example, there is a record with 'number' in column_type, the value of column_value should be a number, even if it's stored as varchar. Same as for 'percentage' and 'currency'. However, if the value of column_type is 'date', the value of column_value should look like '01/09/2012'. What I would like to do is to populate the calendar picker right next to the field 'column_value', if the value of column_type is 'date'. Therefore, create the widget for the column_value like:
So what is the javascript for the calendar picker or how do I accomplish the same goal as above you way?
Re: calendar widget in delegate methodI see. You're making a sort of meta schema layer. If I were you I'd probably approach this problem with pure javascript. Leave the field type as text, but use javascript to alternatively decorate the field depending on what the value of column_type is.
Most of the new widgets that are being developed work this way. They use a text field as a base and then are transformed with javascript into a different type of widget. There are a ton of jQuery widgets that you can use that work this way. (they transform normal text fields into cool widgets). Check out the datepicker widget Javascript file for a sample: http://weblite.ca/svn/dataface/modules/ ... epicker.js What this does is transform all text fields with the xf-datepicker CSS class into datepicker widgets. The docs for the full datepicker module is at http://xataface.com/dox/modules/datepicker/latest But this will only work with 2.0 which isn't finished/released yet. But there are some screenshots that give you an idea. So in your case, you'd want to attach a listener to the column_type field that will automatically undecorate the column_value field then redecorate with another widget type. Hope this helps. -Steve
4 posts
• Page 1 of 1
Who is onlineUsers browsing this forum: No registered users and 10 guests |