material-ui-datatables icon indicating copy to clipboard operation
material-ui-datatables copied to clipboard

how to create customer column for Edit/Delete?

Open thearabbit opened this issue 8 years ago • 4 comments
trafficstars

I would like to create customer column for Edit/Delete

image

thearabbit avatar Mar 30 '17 09:03 thearabbit

@thearabbit Hi, Currently it doesn't support edit features in the component. But if you want to show dropdown and implement edit features by yourself, you can set react nodes as values in data props. for example,

const data = [{
  date: '30/03/2017',
  action: (<DropDownMenu>...),
  ...
}];

hyojin avatar Mar 31 '17 00:03 hyojin

OK, thanks for your reply. I will try soon.

thearabbit avatar Mar 31 '17 04:03 thearabbit

I would like to custom action field with current data row

const data = [{
  _id: '01'
  date: '30/03/2017',
  action: (
    <IconMenu
           iconButtonElement={<IconButton><MoreVertIcon /></IconButton>}
           anchorOrigin={{ horizontal: 'right', vertical: 'top' }}
           targetOrigin={{ horizontal: 'right', vertical: 'top' }}
   >
                <MenuItem
                primaryText="Edit"
                onTouchTap={(event) => this.handleEdit(this._id)}
                 />
                 <MenuItem
                     primaryText="Delete"
                     onTouchTap={(event) => this.handleOpenConfirmDel(this._id)}
                  />
    </IconMenu>
  )
  ...
}];

Please help me to get this doc of current row like above

thearabbit avatar Apr 01 '17 08:04 thearabbit

Considering the scope of your event handler function, In this case, I would say using call method with specific arguments is a solution. And I think the other way is getting from dom using html5 data attribute.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call

hyojin avatar Apr 07 '17 00:04 hyojin