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

Feature Request: Hook for delete and create #53

Closed
ryanlinnane opened this issue Sep 16, 2015 · 4 comments
Closed

Feature Request: Hook for delete and create #53

ryanlinnane opened this issue Sep 16, 2015 · 4 comments

Comments

@ryanlinnane
Copy link

I'd like to use this in conjunction with a backend REST API. Is there an easy way to know when a given action has occurred and on what cell so that i can make the appropriate ajax call? I see that EDIT has a hook for this. Furthermore, I love the automated modal for submission, but is there a way to limit the fields that pop up - i.e. ID may often be autogenerated on the server.

@AllenFang
Copy link
Owner

The hook for delete and create row is great, it's a good enhancement for this component. And your are right, the ID field always generated from server, so the ID field need to be not editable. However, I will spend some time to implement these feature. Thanks for your feedback :)

@AllenFang
Copy link
Owner

Hi @ryanlinnane , I've add the hook for delete and create row on table, the example as follow:

var options = {
  afterDeleteRow: onAfterDeleteRow,  // A hook for after droping rows.
  afterInsertRow: onAfterInsertRow   // A hook for after insert rows
};
//...
<BootstrapTable data={products} options={options}>
  //...
</BootstrapTable>

And about the field limitation in modal for row creation, I've not yet implement it. Maybe in next version :)

@AllenFang
Copy link
Owner

HI @ryanlinnane , about the field limitation in modal for row creation, I think the editable={false} on TableHeaderColumn is a good idea to achieve. But about the row key field, in my opinion, I want make it editable, because the data cant be store without row key. So if you want to make the key field non-editabled, I prefer you create the new row outside, save it and render react-bootstrap-table again :) Anyway, I'll add the editable field in modal in next version.

@AllenFang
Copy link
Owner

HI @ryanlinnane, in 1.0.0, you can use editable={false} on <TableHeaderColumn> to limit the field in modal. if rowkey, you can use <TableHeaderColumn dataField="id" isKey={true} autoValue={true}>Job ID</TableHeaderColumn> to make row key can't be input and auto generate a key for unique identify in this component.

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

2 participants