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.

appendCellHtml ignores numeric value

See original GitHub issue

There was a feature added in appendCellHtml - supporting complex formatters results (formatterResult). When it returns an object instead of string. Nice but it breaks existing code when formatter returns simple non-string value, i.e. number or Date. In this case the value is just ignored.

Current code:

      var formatterResult =  getFormatter(row, m)(row, cell, value, m, item);
...
      // if there is a corresponding row (if not, this is the Add New row or this data hasn't been loaded yet)
      if (item) {
        stringArray.push(typeof formatterResult === 'string' ? formatterResult : formatterResult.text);
      }

if formatterResult is a Number then nothing happens.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
6paccommented, Jun 21, 2017

OK, you’ve convinced me. It’s in the spec, and my suggestion doesn’t cover a Date. Also tweaked the other typeofs, that makes sense.

This has been committed and referenced to this issue. Happy to take pull requests!

0reactions
evil-shrikecommented, Jun 20, 2017

Ok, in this case it will work. But in general Object.prototype.toString is pretty common approach (v === Object(v) is another), see https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/ for details.

Also I noticed there’re other checks with typeof for selectable and focusable. It’s better to check for !== undefined, any value means it’s specified, then convert it to a boolean: instead

      if (rowMetadata && typeof rowMetadata.selectable === "boolean") {
        return rowMetadata.selectable;
      }

do

      if (rowMetadata && rowMetadata.selectable !== "undefined") {
        return !!rowMetadata.selectable;
      }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect integer value: '' for column 'id' at row 1 - Stack Overflow
The first column is the 'id' column, since its an auto_increment field, I left it blank. For some reason, I am unable to...
Read more >
Tables in HTML documents
This attribute, whose value must be an integer > 0, specifies the number of columns "spanned" by the COL element; the COL element...
Read more >
MySQL 8.0 Reference Manual :: 13.2.7 INSERT Statement
For the FLOAT and DECIMAL columns, the string-to-number conversion considers the entire string a valid numeric value. An expression expr can refer to...
Read more >
<tbody>: The Table Body element - HTML - MDN Web Docs
This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char ......
Read more >
Insert standard missing values - MATLAB standardizeMissing
This MATLAB function replaces values specified in indicator with standard missing ... data only and ignores NaT and NaN values in the vector...
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