0

zk keikai-how to add custom button/label to formulabar?

asked 2020-12-07 21:57:28 +0800

wastemails gravatar image wastemails
130 1 1

Please help out how to add custom button/label to formula bar in keikai spreadsheet??

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-12-11 14:46:28 +0800

cor3000 gravatar image cor3000
6094 2 7
ZK Team

updated 2020-12-11 14:48:09 +0800

Here an example adding 2 custom buttons to the formulabar ... not styled yet, just he buttons and event firing

<zk>
    <script><![CDATA[
    zk.afterLoad('zss', function() {
        var xFormulabarCenterCave = {};
        zk.override(zss.FormulabarCenterCave.prototype, xFormulabarCenterCave, {
            $init : function(wgt) {
                xFormulabarCenterCave.$init.apply(this, arguments);
                this.appendChild(this.customMoney = new zss.FormulabarButton({
                        iconSclass: 'z-icon-money',
                        label: 'Money',
                        listeners: {onClick: this.handleMoneyClicked.bind(this)}}));
                this.appendChild(this.customDate = new zss.FormulabarButton({
                        iconSclass: 'z-icon-calendar',
                        label: 'Date',
                        listeners: {onClick: this.handleDateClicked.bind(this)}}));
            },
            handleDateClicked: function(event) {
                this._wgt.fire('onFormulabarDateClicked', null, {toServer:true});
            },
            handleMoneyClicked: function(event) {
                this._wgt.fire('onFormulabarMoneyClicked', null, {toServer:true});
            },
            redraw: function (out) {
                var uid = this.uuid,
                    zcls = this.getZclass(),
                    html = '<div id="' + uid + '">';
                html += (this.editor.redrawHTML_() +
                        '<div id="' + uid + '-expandbtn" class="' + zcls + '-colbtn">' +
                        this.expandBtn.redrawHTML_() +
                        this.customMoney.redrawHTML_() +
                        this.customDate.redrawHTML_() +
                        '</div></div>');
                out.push(html);
            },
        });//zk.override
    });//zk.afterLoad
    ]]></script>
    <spreadsheet showToolbar="true" showFormulabar="true" height="100%"
                 onFormulabarDateClicked="Clients.log(event.getName())"
                 onFormulabarMoneyClicked="Clients.log(event.getName())"
    />
</zk>

result:

image description

link publish delete flag offensive edit

Comments

Thanks a lot, is it not possible to add from Java? It would be nice if this feature is provided from server side.

wastemails ( 2020-12-12 09:06:05 +0800 )edit

No the formula bar is rendered at client side, so custom items must be added at client side. You can add the event listeners for your custom events from java code.

cor3000 ( 2020-12-14 12:07:40 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2020-12-07 21:57:28 +0800

Seen: 6 times

Last updated: Dec 11 '20

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More