Topic: mdb datatable delete options

Group free asked 5 years ago


when I pass id by using onclick , all list items lost from display . How can I delete specific one item from display by using mdb datatable ?


name12 free answered 7 months ago


dsvdsccfdcasdfasfdr3qw 1`1321edwqs


Tomek Makowski staff answered 4 years ago


Could you please be more clearly. Correct me if i'm wrong you have your own data and you want to replace only names in datatables from API and your code snippet would be helpful.Regards.


riskatri free answered 4 years ago


i have a question. i want to make my data table can editable with data from API. if write rows as rows: data.content because if i write rows: [{name: data.content}] i have a problem. what should i do if i want make table clickable? thankyou


Aliaksandr Andrasiuk staff answered 5 years ago


Hello,

It is desirable to store your data in state, then you can use the next function:

     function deleteRow(id){
        let filteredRows = data.rows.filter(row => row !== data.rows[id]);
        data.rows = filteredRows;
      }
        ...
        rows: [
        ....
              {
                name: "Tiger Nixon",
                position: "System Architect",
                office: "Edinburgh",
                age: "61",
                date: "2011/04/25",
                salary: "$320",
                clickEvent: () => deleteRow(id)
              },
        .....

If that doesn't help you then please show me your code snippet.

Best regards,

Aliaksandr from MDB.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.11.1
  • Device: pc
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No
Tags