Regarding inline edit and save using react jquery datat source datatables
Regarding inline edit and save using react jquery datat source datatables

Please help me in adding inline edit and save using react-jquery-datatable [data source]
import React, {Component} from 'react';
const $ = require('jquery');
$.DataTable = require('datatables.net')
export default class Datatable extends Component {
componentDidMount() {
console.log(this.element)
this.$element = $(this.element)
this.$element.DataTable(
{
data: this.props.data,
columns: [
{title: "Key",width: '50%'},
{title: "Value"},
],columnDefs: [
{ "width": "20%", "targets": 0 }
]
}
)
}
componentWillUnmount() {
if (this.$el.Datatable) {
this.$el.Datatable.destroy();
}
}
render() {
return (
<div>
<table id="myTable" className="display" width='100%' ref={element => this.element = element}>
</table>
</div>
);
}
}
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This discussion has been closed.
Answers
Hi @nnshetty ,
Is this using Editor?
Cheers,
Colin
Yes @colin ....i need to make use of editor in reactjs... I saw that whatever u sent..however that does not have a proper tutorial as to how to incorporate that using reactjs
it errors out :TypeError: $.fn.dataTable.Editor is not a constructor
Hi @nnshetty ,
It will say that when it can't load the Editor library - this could be because the license has expired, if you downloaded it more than two weeks ago.
These threads might help: here and here.
Could you look at those, please, and report back if problems persists.
Cheers,
Colin