This below code is showing a button in datebox modal popup but I want clear the date when I will click on the button. I tried lots of things but not able to do it by jQuery method.
<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('<button id="', uuid, '-today" class="', text, '"',
' onClick="var cal = zk.Widget.$(\'$', wgt.parent.id, '\')._pop; cal._value = null; cal._setTime();"',
' >', ' today', '</button>');
}
out.push('<button id="', uuid, '-clear" class="', text, '"',
' onClick="alert(jq(this.parent.$n()))"',
' >', ' clear', '</button>');
}
});
});
</script>
<datebox id="db" ></datebox>
</zk>
In your case, the clear button is a child dom of datebox but not a child widget, this.parent.$n() only works if button is a child widget of datebox.
You can modify it to make it work as below:
I have slightly modified your sample:
I have modified above link code then it's working.
version - zk 6.5.3
or
change this method.
for zk version 7.0 code here