windmill-labs / windmill

Open-source developer platform to power your entire infra and turn scripts into webhooks, workflows and UIs. Fastest workflow engine (13x vs Airflow). Open-source alternative to Retool and Temporal.
https://windmill.dev
Other
9.99k stars 473 forks source link

bug: Can't Create a button (custom component) in the AgGrid #1649

Closed zsnmwy closed 1 year ago

zsnmwy commented 1 year ago

Describe the bug

I tried to follow the document and create a button in AgGrid. But failed. The button did not appear as expected.

image

The function is serialized on return. That's my guess.

image

To reproduce

  1. Create a new APP
  2. Create an AgGrid Component
  3. Create a frontend script
  4. Copy the script from docs.
    
    class BtnCellRenderer {
    constructor() {}
    init(params) {
        this.params = params;
        this.eGui = document.createElement('button');
        this.eGui.innerHTML = 'Push me!';
        this.btnClickedHandler = this.btnClickedHandler.bind(this);
        this.eGui.addEventListener('click', this.btnClickedHandler);
    }
    getGui() {
        return this.eGui;
    }
    destroy() {
        this.eGui.removeEventListener('click', this.btnClickedHandler);
    }
    }
    BtnCellRenderer.prototype.btnClickedHandler = function () {
    if (!state.logs) {
        state.logs = [];
    }
    state.logs.push({
        rowDataAfterChange: JSON.stringify(this.params.data)
    });
    };

return [ { field: 'name' }, { field: 'age' }, { headerName: 'Send row data to state', cellRenderer: BtnCellRenderer } ];


5. Linke the output to the AgGid defs.
<img width="1386" alt="image" src="https://github.com/windmill-labs/windmill/assets/35299017/bc51dd8e-145c-4a2c-a9a6-32eb14c77e9f">

### Expected behavior

The button should be displayed.

Like:

<img width="847" alt="image" src="https://github.com/windmill-labs/windmill/assets/35299017/a4b4f6e8-3847-4516-9c41-9d7824d9694a">

https://www.ag-grid.com/javascript-data-grid/component-cell-renderer/#simple-cell-renderer-example

### Screenshots

_No response_

### Browser information

Chrome 113.0.5672.126

### Application version

Windmill CE v1.104.2

### Additional Context

_No response_
SindreSvendby commented 1 year ago

This worked fine on a self hosted instant with version v1.101.0-12-g94be4a8a.

SindreSvendby commented 1 year ago

Can confirm that this bug is fixed now @rubenfiszel