How to get all fields in a named grid and disable them?

Hi everyone,

I want to create a simple script to disable all input fields in a grid dynamically.
However, I can't a way to do it the plumsail-way, because I can not address the children of a grid-container.

As a workaround, I tried to use vanilla jquery:

function disableGridFields(gridName) {
    let fields = $('.' + gridName)[0].children;
    for (var i = 0; i < fields.length; i++) {
        $(fields[i]).find('input')[0].disabled = true

On first sight, this seems to work, however...

  • fields are only visually disabled.
  • if I update a text input field with i.e.

fd.field('ECTS_Title').value = 'updated value'

the field becomes enabled

  • on numeric input fields, I can not enter a value, but I can use the arrows to modify the value

Conclusion: disabling the html control with jquery does not disable the control at all..

So question: it it possible to dynamically get all the input fields of a named grid and disable them with something like
fd.field(i).disabled = true

any help is appreciated,

kind regards,
Bart Plessers

Hello @bartplessers,

Please try out the code from this post:

1 Like

Perfect! Works like a charm.

1 Like