KUIB 3.0 - 'Data Bound' event function for a Data Gr

Posted by wes.rector on 14-Jun-2018 18:21

If I drag a grid onto a Blank view I can set the "Data Bound Event Function" property, but in the Data Grid view that property is not available. I assume there's a way to have code run when data is bound in a Data Grid view though. Can anyone show me how to do that?

Posted by Radoslav Kirilov on 19-Jun-2018 01:45

Hi,

Indeed the DataGridView does not have exposed grid's DataBound event in the designer. In order to run the code when this event is fired you need to bind to it manually in the onShow event handler: 

    // Fired when view content is loaded
    onShow($scope) {
        console.log('Show');

        this.$scope.$watch(() => {
            return this.$grid;
        }, (newValue, oldValue) => {
            if (newValue) {
                this.$grid.bind('dataBound', (e) => {
                    alert('dataBound');
                });
            }
        });
    }


Best,
Rado

All Replies

Posted by Radoslav Kirilov on 19-Jun-2018 01:45

Hi,

Indeed the DataGridView does not have exposed grid's DataBound event in the designer. In order to run the code when this event is fired you need to bind to it manually in the onShow event handler: 

    // Fired when view content is loaded
    onShow($scope) {
        console.log('Show');

        this.$scope.$watch(() => {
            return this.$grid;
        }, (newValue, oldValue) => {
            if (newValue) {
                this.$grid.bind('dataBound', (e) => {
                    alert('dataBound');
                });
            }
        });
    }


Best,
Rado

Posted by wes.rector on 19-Jun-2018 13:44

Thanks!

This thread is closed