-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Hi,
I have some problems to integrate Sweet Alert or Modal component to the View with Jquery Datatables.
Here part of my code:
import React, {Component} from 'react';
// jQuery plugin - used for DataTables.net
import $ from 'jquery';
import {Grid, Row, Col} from 'react-bootstrap';
import Card from 'components/Card/Card.jsx';
import Button from 'elements/CustomButton/CustomButton.jsx';
import SweetAlert from 'react-bootstrap-sweetalert';
require('datatables.net-responsive');
$.DataTable = require('datatables.net-bs');
class Main extends Component {
constructor(props){
super(props);
this.state = {
alert: null
};
}
warningWithConfirmMessage(){
this.setState({
alert: (
<SweetAlert
warning
style={{display: "block",marginTop: "-100px"}}
title="Are you sure?"
onConfirm={() => this.successDelete()}
onCancel={() => this.hideAlert()}
confirmBtnBsStyle="info"
cancelBtnBsStyle="danger"
confirmBtnText="Sí, bórralo!"
cancelBtnText="Cancelar"
showCancel
>
¿Esta seguro de borrar el usuario?
)
});
}
successDelete(){
this.setState({
alert: (
<SweetAlert
success
style={{display: "block",marginTop: "-100px"}}
title="Deleted!"
onConfirm={() => this.hideAlert()}
onCancel={() => this.hideAlert()}
confirmBtnBsStyle="info"
>
Your imaginary file has been deleted.
)
});
}
hideAlert(){
this.setState({
alert: null
});
}
return (
<Card title="Usuarios del sistema" content={<div className = "fresh-datatables" >
<Button fill onClick={this.warningWithConfirmMessage.bind(this)}>Try me!</Button>
The main problem is that I dont get any errors, but the component is never showed..
in other parts of my project does not work either.
Can you help me??
regards