question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

addRow function is not working properly on version 3.5

See original GitHub issue

When I want to add row to the top of the table, like this: $(selector).tabulator("addRow", {_id: 0}, true); I get this error: “ReferenceError: activeRows is not defined[Learn More] tabulator.min.js:2:29240”

This code was working on version 3.4.*

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
answerquestcommented, May 8, 2018

Yay, fixed it! Added activeRows declaration at the start of the function:

    RowManager.prototype.addRowActual = function (data, pos, index, blockRedraw) {

      var row = new Row(data || {}, this),
          top = this.findAddRowPos(pos),
          dispRows,
          activeRows = this.activeRows; // <-- define activeRows, copying from other places in the code

      if (!index && this.table.options.pagination && this.table.options.paginationAddRow == "page") {

        dispRows = this.getDisplayRows();

        if (top) {

          if (dispRows.length) {

            index = dispRows[0];
          } else {

            if (activeRows.length) { // <-- where the error was happening because activeRows wasn't defined

@olifolkerd I’m not going to do a PR as you’ll need to compile in gulp and all. Will learn that stuff some day so I can contribute.

@blackgod000 as a temporary fix, change your js src to tabulator.js, open it in a text editor, and add a line var activeRows = this.activeRows; at line number 2772, that should make things work for you.

0reactions
olifolkerdcommented, May 19, 2018

Hey @blackgod000

I have pushed a fix for this to the master branch and will include it in this evenings patch release.

Cheers

Oli 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my "add row to table" function not working?
To test if your addData function is working, change the input type of 'submit' to 'button'. If everything is right then it should...
Read more >
Office Scripts: Add Row at End of Worksheet - YouTube
Office Scripts: Add Row at End of Worksheet. 3.5 K views 1 ... Content 0:00 Introduction 0:55 Start scripting 6:40 Move logic to...
Read more >
Add rows - DataTables example
New rows can be added to a DataTable using the row.add() API method. Simply call the API function with the data for the...
Read more >
How to Add / Remove Table Rows Dynamically Using jQuery
Similarly, you can use the .remove() method to remove or delete table rows as well as all everything inside it from the DOM...
Read more >
exceljs - npm
Excel Workbook Manager - Read and Write xlsx and csv Files.. Latest version: 4.3.0, last published: a year ago. Start using exceljs in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found