Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-1983

add a "today" button to datebox's calendar popup

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Normal Normal
    • 8.0.0
    • 7.0.0
    • Components
    • Security Level: Jimmy
    • ZK 8.0.1

      a button in the calendar popup of datebox to jump to today

      this example shows a prototypic implementation, based on ZK 6.5.4, but feature is not required before ZK7

      • the "today"-link might be an icon or needs further localization, when text based
      • it should be possible to enable/disable the button
       
      <zk>
      	<script>
      	zk.afterLoad('zul.db', function () {
      	
      		var _xRenderer = {};
      		zk.override(zul.db.Renderer, _xRenderer, {
      			titleHTML: function (wgt, out, localizedSymbols) {
      				_xRenderer.titleHTML.apply(this, arguments); //call the original method
      				var uuid = wgt.uuid,
      				    view = wgt._view,
      				    text = wgt.getZclass() + '-ctrler';
      				    
      				if(view == 'day') {
      					out.push('&lt;span id="', uuid, '-today" class="', text, '"', 
      						' onClick="var cal = zk.Widget.$(\'$', wgt.parent.id, '\')._pop; cal._value = null; cal._setTime();"',
      						' &gt;', ' today', '&lt;/span&gt;');
      				}
      			}
      		});
      	});		
      	</script>
      	<datebox id="db" onChange=""></datebox>
      </zk>
      

            ChunfuChang ChunfuChang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 2 hours
                1d 2h