Skip to content

SweetAlert and Modal component issue #11

@eduardoamills

Description

@eduardoamills

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions