The code is no longer working when I updated a DataGrid. Please help!!!
This is my JS code:
GridAPI.GridManager.GetGridById($parameters.GridWidgetId).provider.updatingLayout.addHandler(function(grid) {
grid.rows.forEach(function(row) {
if (row.dataItem && row.dataItem.AccountClient && row.dataItem.AccountClient.ClientTypeID === 0) { row.dataItem.Sample_Product.Category = undefined;
}
});
Hi @Edward Muratov
I was able to achieve that by adding the following script to the Grid Initialize event handler:
const flexGrid = OutSystems.GridAPI.GridManager.GetGridById($parameters.GridId).provider; flexGrid.formatItem.addHandler((s, e) => { let row = s.rows[e.row], col = s.columns[e.col]; //update cell value for Number type columns only if ( e.panel.cellType === wijmo.grid.CellType.Cell && ( (col.binding === 'Sample_Product.Price' && row.dataItem.Sample_Product.Price === 0) || (col.binding === 'Sample_Product.Stock' && row.dataItem.Sample_Product.Stock === 0) ) && !s.editRange // ignore cell content update while editing ) { e.cell.textContent = ''; } });
Result:
Hope it helps!
Cheers,GM
Hi @Edward Muratov,
it's hard to help you without testing with code. Can you share your OML, we will check on it.
Attached please find a copy of the oml. Thanks
I'm working on js, but it's pretty hard now, not yet have solution,
but the solution that add the blank text and for 0 value into dropdown option still works, should you use this solution.
HI @Edward Muratov,
The below link help you to resolve your issue. Already in the forum the solution available
https://www.outsystems.com/forums/discussion/71342/outsystems-data-grid-dropdownlisttype-is-display-0-when-having-0-or-nullidentif/
This is an old solution, Anyway, it didn't work.
Hello @Edward Muratov
To make collaboration more efficient, please share a sample oml with your case so we can reproduce it without any missing references since the one you shared simply doesn't work with so many missing references.
Also, you seem to be using version 2.11.0, could you indicate which version were you using where you have that code being used?
Hi Gonçalo Martins! Unfortunately, this code doesn't work for me. Thanks
Could you at least expand a bit more on "this code doesn't work for me" and share an example of your implementation?
Attached please find my oml.
@Edward Muratov that OML has more than 100 errors due to missing dependencies so please isolate your Grid page.
Also, you didn't mention which type of columns you mean so the example is for Number columns since the Dropdowns already have that behavior by default unless you have some bad data.
Here's a sample OML with this working, so check it working with both Number Columns affected by the code I gave and dropdowns with the default behavior:
Please check if your bindings are correct, as I can't replicate anything without having your app in runtime.