[Data Grid] DataGrid edit control (CheckBox does not work)

Forge Component
(41)
Published on 24 Aug by OutSystems R&D
41 votes
Published on 24 Aug by OutSystems R&D

Hi,

I want to make the text item editable or non-editable and dynamically control it by turning on / off the check box.


GridContainer AdvancedFormat

onBeginningEdit: addCheckEditable

And the script was generated as follows.


// Called when entering edit mode

 addCheckEditable = function (e) {

    // When editing a column called Attribute4

    if (e.panel.columns [e.col] .binding == 'Attribute4') {

        // If IsAttribute is not checked

        if (e.panel.rows [e.row] .dataItem.IsAttribute == false) {

            // Disable editing

            e.cancel = true;

            return false;

        }

    }

    return this.beginningEdit.raise (this, e);

};


Control is done when the check box is not checked.

However, I cannot check the important check box.

If you remove the script call in AdvancedFormat, the checkbox will work properly.


Does anyone know this solution?

Can anyone please answer my question?

Hello,

What Grid version are you using?

If you are using the lastest version, it seems you could try to change:

 if (e.panel.rows [e.row] .dataItem.IsAttribute == false) {

to

if (!!e.panel.rows[e.row].dataItem.os_isSelected == false) {

Please let me know if this helps.

Bruno Martinho

Version is 2.1.9.


The way I communicated was bad.

You told me about Checkbox Selection of Grid Container, right?


I am using GridColumnCheckbox.

IsAttribute is an image of Entity's Attribute.

I want to control editing when the GridColumnCheckbox changes dynamically.

Solution

Sorry that I didn't understood your problem.

It seems that the checkbox becomes not editable because

this.beginningEdit.raise (this, e); returns undefined


So I would suggest to replace:


return this.beginningEdit.raise (this, e);


by


this.beginningEdit.raise (this, e);

return true;


Please let me know if this helps.

Solution

Bruno Martinho wrote:

Sorry that I didn't understood your problem.

It seems that the checkbox becomes not editable because

this.beginningEdit.raise (this, e); returns undefined


So I would suggest to replace:


return this.beginningEdit.raise (this, e);


by


this.beginningEdit.raise (this, e);

return true;


Please let me know if this helps.


Thank you very much.
I fixed the return part and it worked correctly.