[Data Grid Web] Data grid web  - edit auto generated columns
Forge component by OutSystems R&D
Application Type
Traditional Web

After updating data grid web to the version 2.18.1  started having issues with edit functinonality on current project. Since we use some custom code ( ex: a custom column generator) I also tested a clean install on my personal enviromment and got the same  javascript error with auto generated columns . 

When clicking cell to edit I get the following error: 

GridFramework.js?35070:6851 Uncaught TypeError: Cannot read property 'comparatorField' of undefined

    at Object.filterOptions (GridFramework.js?35070:6851)

    at Object.onBeforeEditing (GridFramework.js?35070:7881)

    at gObj.event.grid.cellBeginningEditHandler (GridFramework.js?35070:5846)

    at Event.raise (WijmoJS.js?35070:14)

    at FlexGrid.onBeginningEdit (WijmoGridJS.js?35070:14)

    at _EditHandler.startEditing (WijmoGridJS.js?35070:14)

    at FlexGrid.startEditing (WijmoGridJS.js?35070:14)

    at _MouseHandler._click (WijmoGridJS.js?35070:14)

filterOptions @ GridFramework.js?35070:6851

onBeforeEditing @ GridFramework.js?35070:7881

gObj.event.grid.cellBeginningEditHandler @ GridFramework.js?35070:5846

Event.raise @ WijmoJS.js?35070:14

FlexGrid.onBeginningEdit @ WijmoGridJS.js?35070:14

_EditHandler.startEditing @ WijmoGridJS.js?35070:14

FlexGrid.startEditing @ WijmoGridJS.js?35070:14


_MouseHandler._click @ WijmoGridJS.js?35070:14



After debugging  it seens that in this code gObj.columns.rendered is empty

filterOptions: function (gridId, e) {

            var gObj = GridOS.ComponentUtils.getGridObjectById(gridId);

            var binding = gObj.grid.getColumn(e.col).binding;

            var comparatorField = gObj.columns.rendered[binding].comparatorField;

            if (comparatorField) {

                GridOS.DataFeature.updateConsumers(gridId, e.row, comparatorField);


            }


What can be done to solve this?


Solution

Hello @Bruno Marques 

I would like to say that yesterday we made a new release with some fixes for your issue.

You should face no more issues using AutoGenerateColumns on EditMode.

We still have an issue  AutoGenerateColumns along with Actions/ConfigurationSaveButton. This is a much more complex feature, and will be proper scheduled.

Thank you 

Ricardo Valim 

Hello Bruno,


Can you please inform us what version you had before the upgrade?


Thank you,

Gabriel Lundgren

Cannot confirm exact version , but last data grid application update on project was 7/10/2019 . Was not updated for a logn time , we updated to most recent version in end of december 2020.

Edit function was mostly not used , only had reports of the bug reaching me a couple of weeks ago.

Also as said before ,  on my personal account also  installed for first time data grid to test and i'm seeing the same error.


Any nes in this issue?

Hello @Bruno Marques 

During 2020 we made a big effort here to clean up the code, and improve our grid performance, so we have a lot of code change.

The way we handle the dropdowns also changed, but we always try to make changes in a progressively way to avoid big impacts, as your code stays for too long without any update, I can't exactly say what's the issue you are facing by the piece of code you sent.

I suggest you to send us your OML along with a step by step of the actions to reproduce the error. So we can do a better analysis over it. 

Kind Regards

Ricardo Valim



Hello @Bruno Marques 

Sorry for the delay to answer you.

In Version 2.1.11, all the dropdown controls were changed to use native wijmo for select controls called DataMap. What happened before 2.1.11 was that, in the dropdown column, two columns were created, one bound to the JSONFieldId and another column that was hidden that was bound to JSONFieldLabel.

And Version 2.17.1, to fix a major bug, we had to change some columns custom editor to the wijmo column editor. 

I'm guessing that one of these two changes might the ones causing the problem. 

You have custom code in the columns, are you able to isolate this and share an OML for us to look at? If we could reproduce your error it would be easier to give you further details,

Thanks,

Bruno Martinho

Ok crreated a test module with 2 pages . In page DatagridAutogenearated you can see a simple grid that is fed by a res url and columns are using the normal auto generate .

In page DatagridCustomGenerated I'm using the custom generated code for the columns . Both gice the same error when clicking to edit on a cell

Code is commented. Might have strange validation because I had to isolate it from extra code in the page.



testGridAutov27.oml

Hi @Bruno Marques 

We do found an issue on our AutoGenerated grid, I already opened a support issue for analysis, thanks for exposing this issue. =D

I presume your custom page will work after the fix. But something that we never found so far, is the usage of JS to build columns, so I would like to first understand the reason, and we can think on a best solution for you. (Code sample bellow)

var column41107 = new wijmo.grid.Column();
column41107.binding = 'TEST1';
column41107.title = 'test1';
column41107.dataType = 1;
column41107.align = 'left';
gridColumns.push(column41107);

Using the code above, your solution will bypass a lot of OS control-code that is responsible for handling the grid and its features, and you may miss some features on the way. I would say, we can't even support future issues that you may have.

Considering OS as a low code solution, we try to encapsulate the work of building grid and columns, is there a specific need for you to create columns in the above manner?

Are you missing a feature on the grid?

What you need is a way to add dynamically columns? If so, I would say we are not prepare for it, dynamical columns, may be the reason for having different datasets(with different structures) on the grid, and this we don't support. In this case I suggest you use multiple pages, each of them with the specific structure you need.

Kind Regards

Ricardo Valim

Thanks for the update

In out application its the user that defines the dynamic entities and its attributes including formating of data. We save data in SQL server DB or other external service. 

Useful things woluld be maybe the ability to send indormation about the columns we want to show ( formating , display name,etc) in the REST that feeds the grid or in other field(column list?). Wich also by the way if we could directly feed data JSON would be helpful.

On our application we also applied things like : export transposed excel , saving filters in session variables, click row events


I am not sure if our grid is the best solution for a Pivot Table or a Transposed grid, it was designed to be a simple Grid, although you can achieve your goals with some code. ??

Any ideas you have can be registered here,  they can be voted by the community and depending on the votes, can enter on the team's schedule.

About the data-edition issue I discovered a simple solution, and may be possible to be delivered on the next release, which should happen next week.

Something I noticed analyzing your issue is that the usage of AutoGenerateColumns along with Actions/ConfigurationSaveButton, is not working perfectly. This is a much more complex feature, so may be not delivered together with the data edition issue.



Solution

Hello @Bruno Marques 

I would like to say that yesterday we made a new release with some fixes for your issue.

You should face no more issues using AutoGenerateColumns on EditMode.

We still have an issue  AutoGenerateColumns along with Actions/ConfigurationSaveButton. This is a much more complex feature, and will be proper scheduled.

Thank you 

Ricardo Valim 

Sorry . Only managed to test i today . It worked and my code for saving also worked. thank you

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