How to use the ag-grid-community.Events function in ag-grid-community

To help you get started, we’ve selected a few ag-grid-community examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ag-grid / ag-grid-enterprise / dist / lib / statusBar / providedPanels / totalRowsComp.js View on Github external
TotalRowsComp.prototype.postConstruct = function () {
        this.setLabel('totalRows', 'Total Rows');
        // this component is only really useful with client side row model
        if (this.gridApi.getModel().getType() !== 'clientSide') {
            console.warn("ag-Grid: agTotalRowCountComponent should only be used with the client side row model.");
            return;
        }
        this.addCssClass('ag-status-panel');
        this.addCssClass('ag-status-panel-total-row-count');
        this.setDisplayed(true);
        var listener = this.onDataChanged.bind(this);
        this.eventService.addEventListener(ag_grid_community_1.Events.EVENT_MODEL_UPDATED, listener);
    };
    TotalRowsComp.prototype.onDataChanged = function () {
github ag-grid / ag-grid-enterprise / dist / lib / statusBar / providedPanels / filteredRowsComp.js View on Github external
FilteredRowsComp.prototype.postConstruct = function () {
        this.setLabel('filteredRows', 'Filtered');
        // this component is only really useful with client side row model
        if (this.gridApi.getModel().getType() !== 'clientSide') {
            console.warn("ag-Grid: agFilteredRowCountComponent should only be used with the client side row model.");
            return;
        }
        this.addCssClass('ag-status-panel');
        this.addCssClass('ag-status-panel-filtered-row-count');
        this.setDisplayed(true);
        var listener = this.onDataChanged.bind(this);
        this.eventService.addEventListener(ag_grid_community_1.Events.EVENT_MODEL_UPDATED, listener);
    };
    FilteredRowsComp.prototype.onDataChanged = function () {
github ag-grid / ag-grid-enterprise / dist / lib / rowModels / serverSide / serverSideRowModel.js View on Github external
ServerSideRowModel.prototype.reset = function () {
        this.rootNode = new ag_grid_community_1.RowNode();
        this.rootNode.group = true;
        this.rootNode.level = -1;
        this.getContext().wireBean(this.rootNode);
        if (this.datasource) {
            this.createNewRowNodeBlockLoader();
            this.cacheParams = this.createCacheParams();
            this.createNodeCache(this.rootNode);
            this.updateRowIndexesAndBounds();
        }
        // this event: 1) clears selection 2) updates filters 3) shows/hides 'no rows' overlay
        var rowDataChangedEvent = {
            type: ag_grid_community_1.Events.EVENT_ROW_DATA_CHANGED,
            api: this.gridApi,
            columnApi: this.columnApi
        };
        this.eventService.dispatchEvent(rowDataChangedEvent);
        // this gets the row to render rows (or remove the previously rendered rows, as it's blank to start).
        // important to NOT pass in an event with keepRenderedRows or animate, as we want the renderer
        // to treat the rows as new rows, as it's all new data
        var modelUpdatedEvent = {
            type: ag_grid_community_1.Events.EVENT_MODEL_UPDATED,
            api: this.gridApi,
            columnApi: this.columnApi,
            animate: false,
            keepRenderedRows: false,
            newData: false,
            newPage: false
        };
github ag-grid / ag-grid-enterprise / dist / lib / setFilter / setFilter.js View on Github external
SetFilter.prototype.setupSyncValuesLikeExcel = function () {
        var _this = this;
        var col = this.setFilterParams.column;
        var rowDataUpdatedListener = function () {
            _this.resetFilterValuesAndReapplyModel();
        };
        var cellValueChangedListener = function (event) {
            // only interested in changes to do with this column
            if (event.column !== col) {
                return;
            }
            _this.resetFilterValuesAndReapplyModel();
        };
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_ROW_DATA_UPDATED, rowDataUpdatedListener);
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_CELL_VALUE_CHANGED, cellValueChangedListener);
    };
    SetFilter.prototype.updateCheckboxIcon = function () {
github ag-grid / ag-grid-enterprise / dist / lib / statusBar / providedPanels / selectedRowsComp.js View on Github external
SelectedRowsComp.prototype.postConstruct = function () {
        if (!this.isValidRowModel()) {
            console.warn("ag-Grid: agSelectedRowCountComponent should only be used with the client and server side row model.");
            return;
        }
        this.setLabel('selectedRows', 'Selected');
        this.addCssClass('ag-status-panel');
        this.addCssClass('ag-status-panel-selected-row-count');
        var selectedRowCount = this.gridApi.getSelectedRows().length;
        this.setValue(selectedRowCount);
        this.setDisplayed(selectedRowCount > 0);
        var eventListener = this.onRowSelectionChanged.bind(this);
        this.eventService.addEventListener(ag_grid_community_1.Events.EVENT_MODEL_UPDATED, eventListener);
        this.eventService.addEventListener(ag_grid_community_1.Events.EVENT_SELECTION_CHANGED, eventListener);
    };
    SelectedRowsComp.prototype.isValidRowModel = function () {
github ag-grid / ag-grid-enterprise / dist / lib / sideBar / providedPanels / columns / dropZone / dropZoneColumnComp.js View on Github external
var itemSelected = function () {
            hidePopup();
            if (_this.gridOptionsWrapper.isFunctionsPassive()) {
                var event_1 = {
                    type: ag_grid_community_1.Events.EVENT_COLUMN_AGG_FUNC_CHANGE_REQUEST,
                    columns: [_this.column],
                    aggFunc: value,
                    api: _this.gridApi,
                    columnApi: _this.columnApi
                };
                _this.eventService.dispatchEvent(event_1);
            }
            else {
                _this.columnController.setColumnAggFunc(_this.column, value, "toolPanelDragAndDrop");
            }
        };
        var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc();
github ag-grid / ag-grid-enterprise / dist / lib / chartAdaptor / chartComp / chartController.js View on Github external
ChartController.prototype.init = function () {
        var _this = this;
        this.updateForGridChange();
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_CHART_RANGE_SELECTION_CHANGED, function (event) {
            if (event.id && event.id === _this.model.getChartId()) {
                _this.updateForGridChange();
            }
        });
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_COLUMN_MOVED, this.updateForGridChange.bind(this));
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_COLUMN_PINNED, this.updateForGridChange.bind(this));
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_MODEL_UPDATED, this.updateForGridChange.bind(this));
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_CELL_VALUE_CHANGED, this.updateForGridChange.bind(this));
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_COLUMN_VISIBLE, this.updateForGridChange.bind(this));
    };
    ChartController.prototype.updateForGridChange = function () {
github ag-grid / ag-grid-enterprise / dist / lib / clipboardService.js View on Github external
}
            if (ag_grid_community_1._.missingOrEmpty(parsedData)) {
                return;
            }
            _this.eventService.dispatchEvent({
                type: ag_grid_community_1.Events.EVENT_PASTE_START,
                api: _this.gridOptionsWrapper.getApi(),
                columnApi: _this.gridOptionsWrapper.getColumnApi(),
                source: 'clipboard'
            });
            var singleCellInClipboard = parsedData.length == 1 && parsedData[0].length == 1;
            var rangeActive = _this.rangeController.isMoreThanOneCell();
            rangeActive && !singleCellInClipboard ?
                _this.pasteIntoActiveRange(parsedData) : _this.pasteStartingFromFocusedCell(parsedData);
            _this.eventService.dispatchEvent({
                type: ag_grid_community_1.Events.EVENT_PASTE_END,
                api: _this.gridOptionsWrapper.getApi(),
                columnApi: _this.gridOptionsWrapper.getColumnApi(),
                source: 'clipboard'
            });
        });
    };
github ag-grid / ag-grid-enterprise / dist / lib / charts / chartRangeDatasource.js View on Github external
ChartRangeDatasource.prototype.postConstruct = function () {
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_MODEL_UPDATED, this.onModelUpdated.bind(this));
        this.addDestroyableEventListener(this.eventService, ag_grid_community_1.Events.EVENT_CELL_VALUE_CHANGED, this.onModelUpdated.bind(this));
        this.reset();
    };
    ChartRangeDatasource.prototype.reset = function () {
github ag-grid / ag-grid-enterprise / dist / lib / rangeController.js View on Github external
RangeController.prototype.dispatchChangedEvent = function (started, finished) {
        var event = {
            type: ag_grid_community_1.Events.EVENT_RANGE_SELECTION_CHANGED,
            api: this.gridApi,
            columnApi: this.columnApi,
            started: started,
            finished: finished
        };
        this.eventService.dispatchEvent(event);
    };
    RangeController.prototype.calculateColumnsBetween = function (columnFrom, columnTo) {