Topic: Accesing a particular column in Table Editor

gkpsoriana free asked 5 years ago


Hi there, How do I change programmatically the value of a particular column in the wrapperModalEditor? I need to change it in this event:

$('#modalEdit').on('shown.bs.modal', function() { // code to update the value of a particular column: });

Thank You


Anna Morawska staff answered 5 years ago


Hi there,

unfortunately, there is no easy way to do this - you have to write your own JS function, which selects all the tr, takes the specific td, and replace its value, something like shown bellow:

$('#modalEdit').on('shown.bs.modal', function () {
  const rows = document.querySelectorAll('#dtBasicExample tr');
  const rowsArray = Array.from(rows)
  rowsArray.slice(1).forEach(row => {
    row.cells[2].innerHTML = '?';
  })
});


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 jQuery
  • MDB Version: 4.7.3
  • Device: MacBook Pro (15-inch, 2017)
  • Browser: Chrome
  • OS: macOS Mojave Version 10.14.3
  • Provided sample code: No
  • Provided link: No