Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add onBeforeEditorShow and onBeforeEditorHide callbacks to Column on DataTable with cell editing #589

Closed
KoushikVanama opened this issue Sep 25, 2018 · 2 comments
Assignees
Labels
Type: New Feature Issue contains a new feature or new component request
Milestone

Comments

@KoushikVanama
Copy link

KoushikVanama commented Sep 25, 2018

I'm submitting a ...

[X] bug report
[ ] feature request
[ ] support request

Example:
In my code, I have a usecase like this

<DataTable value={this.state.rows} scrollable="true" onRowClick={rowClicked} editable={true}>
              <Column field="dayPart" header="DAYPART" />
              <Column field="start_time" header="START TIME" editor={this.sliderTemplate} />
              <Column field="name" header="NAME" />
</DataTable>

and my sliderTemplate() returns a component and looks like this

sliderTemplate = (props) => {    
    return(
      <div>
        <TimeSlider format={12} tableInfo={props} onValueSelectSlider={this.handleSelectedValueTS} />
      </div>
    )
}

Screenshot:
image

On clicking start_time column field the existing value is disappearing and component is showing in place of it. But how can I make sure that the existing value shows as is and the TimeSlider component shows below to that field.
I think this makes sense. Is it achievable?

Please tell us about your environment:

React version: ^16.4.1

PrimeReact version: ^2.0.0-beta.5

Browsers: Chrome 69.0.3497.100v

Language: JSX

@deepak-ww
Copy link

@KoushikVanama I am also facing the same issue. If you got a solution to this then can you please share it. Thanks.

@mertsincan mertsincan added the Status: Pending Review Issue or pull request is being reviewed by Core Team label Feb 9, 2021
@mertsincan mertsincan added this to the 6.1.0 milestone Feb 9, 2021
@mertsincan mertsincan added Type: New Feature Issue contains a new feature or new component request and removed Status: Pending Review Issue or pull request is being reviewed by Core Team labels Mar 5, 2021
@mertsincan mertsincan self-assigned this Mar 5, 2021
@mertsincan mertsincan changed the title To persist/show existing column field value when used editor in Datatable Add onBeforeEditorShow and onBeforeEditorHide callbacks to Column on DataTable with cell editing Mar 5, 2021
@mertsincan
Copy link
Member

Hi,
Added two callbacks to control editing phase;
onBeforeEditorHide?(e: {originalEvent: Event, columnProps: any}) -> Callback to invoke before the cell editor is shown.
onBeforeEditorShow?(e: {originalEvent: Event, columnProps: any}) -> Callback to invoke before the cell editor is hidden.

onBeforeEditorHide() {
    //condition
   
    return; // prevent cell closing
}

Also, I made some changes related to editing cells on 6.1.0.

Best Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: New Feature Issue contains a new feature or new component request
Projects
None yet
Development

No branches or pull requests

3 participants