holstyboy pro asked 2 years ago


*_Expected behavior_*i can't get my datatable showing the "only recent" data.

Actual behavior the datatable is always "adding" columns and rows

Resources (screenshots, code snippets etc.)

HTML

 <div id="accPostings" data-mdb-selectable="true" data-mdb-max-height="220" data-mdb-fixed-header="true" data-mdb-striped="true" data-mdb-sm="true"></div>    

JS

function gotAccountingPostingData(accountPostingData) { 
  const accounting = { 
    columns: ['Kontierungstyp', 'Sachkonto', 'Beschreibung'],
    rows: [] 
  };

  accountPostingData.forEach(element => {
    accounting.rows = accountPostingData;
  });

  const accPostings = document.getElementById('accPostings');
  new mdb.Datatable(accPostings, accounting);
}

sorry image upload is not working for me....


Grzegorz Bujański staff answered 2 years ago


I need more information. I'm not sure if I understand correctly. Please describe in more detail what is the error and what effect you would like to achieve. Is it that only the last row of data is shown? What is the structure of the data provided as accountPostingData? Can you create a snippet that shows these errors?


holstyboy pro commented 2 years ago

hi Grzegorz,

got it solved my self... didn't assign the datatable properly...

here is the code which works well (updates the datatable content):

const accounting = {
  columns: ['Kontierungstyp', 'Sachkonto', 'Beschreibung'],
  rows: [],
  };

accountPostingData.forEach(element => {
accounting.rows = accountPostingData;
});

const accPosting = new mdb.Datatable(document.getElementById('accPostings'));
accPosting.update(accounting,{entriesOptions: [4,8,16]});


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 4.0.0
  • Device: MAC mini
  • Browser: Chrome: Version 100.0.4896.127
  • OS: MACOS: Monterey 12.3.1
  • Provided sample code: No
  • Provided link: No