14
Views
3
Comments
[OutSystems Data Grid] Bug when using string comparisons for conditional styling on a mixed field
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive

In gridframework.js there's the following snippet:


If I have a list which looks like: ["1", "Abc", "1Abc"]
And I would like to do a startsWith kind of conditional styling, for the first item it would be marked as a "number" type, which does not have the toLowerCase() method, which in turn leads to an error/crash.

A very simple fix for this would be to just always ensure the value is a String type by using a cast or constructor or ToString() method. (Personally I think using the constructor is the best approach.)

So for example:

cellValue = String(cellValue), comparedValue = String(comparedValue);


It's honestly crazy how there's no enforcing on data types (and that nobody has ever noticed this before?) 


UserImage.jpg
Jayaprakash Ramesh
AI Generated

hi @Joey Moree 

The function implicitly assumes cellValue and comparedValue are strings, but in mixed datasets numeric values can slip through and cause runtime errors when calling toLowerCase(). A simple and safe improvement would be to normalize both values to strings at the start (for example, using String(cellValue) and String(comparedValue)). This would make the logic more defensive and prevent crashes without affecting existing behavior.

This answer was AI-generated. Please read it carefully and use the forums for clarifications
2017-12-13 08-27-28
Joey Moree

This comment perfectly showcases everything that is wrong with the forums nowadays (and why I have stopped engaging with in for the last year).

  • Didn't read the post
  • Using ChatGPT to write up comments or posts
  • Posting to gain points (gaming the system)
  • Useless comment is useless


In case you still didn't understand, I'll try to elaborate within 1 sentence:

"You literally act like an echochamber by repeating everything I mentioned in the original post, this is a bug report aimed towards the Outsystems Team so they can update the official Data Grid component."

2023-10-16 05-50-48
Shingo Lam

In my opinion, most of the systems will use table (data grid maybe) to show the data with the same data type in 1 column. Its rare that data mixes the number and text in the same column. 
Actually, you have nicely caught the hidden bug which can save a lot of time for others.

Thank you @Joey Moree , please keep this post updated, I also wanna follow the fix

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.