Mike Gledhill
Mike Gledhill

Reputation: 29213

agGrid for React: hide/show a pinned row

Does anyone know how to make a Pinned Top-Row programmatically disappear in React ?

I have a simple React agGrid, with a footer bar with an "Add new row" button on it.

When you click on this button, this bit of code makes a Pinned-Top row appear, and I have some other React code to set the focus on the first editable cell, ready for a user to type something.

const onAddNewRow = (api) => {
    api.setGridOption("pinnedTopRowData", pinnedTopRowData);
    api.refreshCells({force:true});
}

... but I can't find a way to make this Pinned-Row disappear, once the user has finished entering this row.

Is this possible ?

Upvotes: 1

Views: 28

Answers (1)

Bhagya Krishna
Bhagya Krishna

Reputation: 89

Can you try calling this function after user finishes entering data?

const removePinnedTopRow = (api) => { 
  api.setGridOption("pinnedTopRowData", []); 
  api.refreshCells({ force: true }); 
};

Upvotes: 2

Related Questions