Skip to content

Added code for custom buttons #528

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

Closed
wants to merge 1 commit into from
Closed

Added code for custom buttons #528

wants to merge 1 commit into from

Conversation

mbaroukh
Copy link

Hi,

I just added the ability to put custom buttons in the toolbar.

You can see it in action here :
https://www.baroukh.com/nb/react-bootstrap-table-doc/#/examples/custom

I needed it for a project and it is enough for me but if this pull request is ok for you, I'll take time to link (if asked) those buttons to currently selected lines so the action can occur on specific rows.

Thanks for this library !

Mike

@mbaroukh
Copy link
Author

I should have added a code example ...
custom buttons are just an object passed to BootstrapTable :

const customButtons = [
      {
        text: 'Display an alert',
        handler: () => alert('Custom button Clicked')
      },
      {
        text: 'Do not click here !',
        handler: () => alert('You, bad boy !'),
        bsStyle: 'warning',
        icon: 'alert'
      }
    ];
    return (
      <BootstrapTable
          data={ products }
          customButtons={ customButtons }>
        <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
        <TableHeaderColumn dataField='name'>Product Name</TableHeaderColumn>
        <TableHeaderColumn dataField='price'>Product Price</TableHeaderColumn>
      </BootstrapTable>
    );

@AllenFang
Copy link
Owner

AllenFang commented Jun 23, 2016

@mbaroukh, that's awesome, it's a good improvement. But you know, there're a lot of issues which hope they can add not only button but also select, field,, etc. So I've planned to start work for v3.0.0, you can check #497. I think I will make these component(insert button, search field, toolBar.. etc) become React components and export to user, so that they have more ability to customize these components. So will not merge this PR.

Anyway, Thanks your contribution 💯 You did a great job :)

@AllenFang AllenFang closed this Jun 23, 2016
@tarim
Copy link

tarim commented Jul 5, 2016

Hi @mbaroukh ,

I tried to use your code with latest master branch, and it doesn't work for me. any idea please?

@mbaroukh
Copy link
Author

mbaroukh commented Jul 6, 2016

Hi @tarim .
Which code do you tried ? The sample above ? It is relative to a pull request (464ecde) that will not be merged.
Custom buttons will be in v3 (cf #497) but if you need custom buttons now you can use my patch until v3 is out.

@tarim
Copy link

tarim commented Jul 6, 2016

Hi @mbaroukh ,

Yes, I did exactly you described on your code, but somehow the custom button did not show up on my page. I have no idea why.

Thanks,

@zRaspina
Copy link

zRaspina commented Jan 1, 2017

Hi @mbaroukh,
I need custom button, is it exist in new version now?

/CC: @AllenFang

@AllenFang
Copy link
Owner

@zRaspina, check #497 (comment), you can check the examples for how to custom the buttons.

The v3.0.0-beta already released, the newest version is v3.0.0-beta.6.

@zRaspina
Copy link

zRaspina commented Jan 2, 2017

@AllenFang, I can't find related example about custom buttons. Can you post link here man? 😉
When you want to release v3.0.0 Final?

@AllenFang
Copy link
Owner

AllenFang commented Jan 2, 2017

https://github.com/AllenFang/react-bootstrap-table/tree/v3.0.0-dev/examples/js/custom

When you want to release v3.0.0 Final?

I've no idea, maybe on February or March(After chinese new year)

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

Successfully merging this pull request may close these issues.

5 participants