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

Using custom components for cell editing #162

Closed
markmywords opened this issue Dec 2, 2015 · 8 comments
Closed

Using custom components for cell editing #162

markmywords opened this issue Dec 2, 2015 · 8 comments

Comments

@markmywords
Copy link

Hi there,

I was wondering if the ability of using custom components for cell editing wouldn't be a nice feature to have. Use cases could be file upload fields or date pickers. Adding such editors to the core would probably be out of scope but the ability to define and pass custom editor components to react-bootstrap-table certainly would be nice.

I already forked the project and had a go at it myself but I am not (yet!) a react.js pro, so I am unsure if my strategy for implement is the way to go or not :)

@AllenFang
Copy link
Owner

@markmywords, thanks you this component. I thinks the data picker can be included to the core, but upload field is a little bad idea, it need a custom component for user to define their editing component. So I need sometime to think about that :) In addition, if you have any questions, feel free to ask

@markmywords
Copy link
Author

Hi and thank you for your fast reply. Yeah, a file uploader might not be a use case for a lot of people and I just wanted to use it as an example. What I needed for example was a select field where I can store an object id as value and display the object name at the same time. For this I just added the following to Editor.js:

else if(editable.type === 'custom'){
    var CustomWidget = editable.widget;
    return(
        <CustomWidget {...attr} attr={attr} options={editable.options} defaultValue={defaultValue} />
     )
}

And in TableEditColumn.js I changed

var input = this.refs.inputRef

to

var input = ReactDOM.findDOMNode(this.refs.inputRef)

It works fine but I don't know if this a good solution in react.js. I posted this issue to see if there is interest and maybe someone else is looking for a way to do something similar :)

And thanks for providing this great library btw!

@AllenFang
Copy link
Owner

It's seems like good at my first seeing, maybe you can make a PR and I can help you to make this cool feature be better :)

@dannysindra
Copy link

+1 for the datepicker in editing + inserting new data.

@agm1981
Copy link

agm1981 commented May 19, 2016

Any file uploader on the horizon?

@AllenFang
Copy link
Owner

hi @battarro and @dannysindra, Hope I can support it in recently, but I'm busy on my work, so PR is welcome. I promise I'll keep these asking feature in my mind, but there're a lot of things to do so that any improvement will be slow currently. sorry guys ;(

@AllenFang
Copy link
Owner

Released on v2.4.0. Check this example

@AllenFang
Copy link
Owner

v2.4.1 enable to use date picker on row insert and cell editing, check this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants