Home > Forum > General > How to achieve this in Item List in Webcon 2023

How to achieve this in Item List in Webcon 2023
1

Hi!
So I have this Item List in "Orders app". Lets say it has 10 columns. 6 Of those columns can be editable depending on subprocesses or other proceses. So there is a query, that if returns 1 it means that column can be edited by a user, if 0 then the column in this row is blocked.
For that I am using "Column edit restrictions" from the "Permissions" tab in the studio.
And it works great. For few rows. If there are more rows it works really slow. I made some analitics. The query is executed in 20-180 ms depending on many things. So lets say it is 50 ms.
For 6 columns it means it is executed 6 times, so it takes 300 ms. For 10 rows it is 3 seconds. And of course orders can have many more rows.

So I came up with an idea. I made technical Data Row column. It returns 1 if the columns should be editable in current row and 0 if not. It's just a copy of an above query.
Then I changed "Column edit restrictions" to just check this Data Row Column and block column depending on technical row.
That was great, 6x faster form loading.

And that all worked in Webcon BPS 2022. In BPS 2023 it is not working.

I beleave there was a change in the order of Data Row column of Item List execution. I think Data Rows queries are now executed at last, after it checks if columns should be blocked.

How can I achieve this in BPS2023?

MVP
In reply to: Jarosław Dziekan

Bump

Hi,

I played around a bit with a simplified version. I didn't noticed an issue here.
I have an item list with 50 rows, 10 columns + 1 Data Row column, with a simple select statement. The execution of this takes 2 seconds.

1: Without any edit restriction it takes 171 ms
2: With restrictions it takes 188 ms
3: Is a custom solution which takes 186 ms

I have been using 2023.1.3.76

The custom solution is build using an html field, rendered after the item list. It calls a normal form rule, which in turn calls a JS Form rule.



function disabledEnableCell (column) {
let enabled = #{BRP:101}#
// Enable/disable input, div and buttons; div and buttons need to be disabled for picker fields
// we need to use attr or removeAttr because $.prop does not work
if (enabled == false) {
column.querySelector("input").setAttribute("disabled","disabled");
column.querySelector(".input-group-control__input").classList.add("input-group-control__input--disabled")
} else{
column.querySelector("input").removeAttribute("disabled");
column.querySelector(".input-group-control__input").classList.remove("input-group-control__input--disabled")
}
}
let rowNumber = uxContext.getCurrentRowNumber();
disabledEnableCell(document.querySelector("tr[data-index='" + rowNumber + "'] td[data-key='#{SFLD:128}#']"));
disabledEnableCell(document.querySelector("tr[data-index='" + rowNumber + "'] td[data-key='#{SFLD:130}#']"));
disabledEnableCell(document.querySelector("tr[data-index='" + rowNumber + "'] td[data-key='#{SFLD:131}#']"));
disabledEnableCell(document.querySelector("tr[data-index='" + rowNumber + "'] td[data-key='#{SFLD:121}#']"));
disabledEnableCell(document.querySelector("tr[data-index='" + rowNumber + "'] td[data-key='#{SFLD:123}#']"));
disabledEnableCell(document.querySelector("tr[data-index='" + rowNumber + "'] td[data-key='#{SFLD:125}#']"));


You could give this a shot.

Best regards,
Daniel