Set row in readOnly with physicalIndex

Tags: #<Tag:0x00007f8b28c7b4f0>

Hello,

By default i have set all my table row in readOnly true, and when I click on one row this one have to be set on readOnly false.
I have make a function in afterSelection callback for do this and it’s work :

afterSelection: function(row, col) {
            if(countClick === 0 && editIsActive === true) {
                currentRow = row;
                hot.updateSettings({
                    cells: function (row, col, prop) {
                        var cellProperties = {};
                        if (row == currentRow) {
                            cellProperties.readOnly = false;
                        }
                        return cellProperties;
                    }
                });
            }
            countClick++;
        },

But I have some trouble with this function because when in apply filter on the table this function :

 afterSelection: function(row, col)

not take the same index as this function :

cells: function (row, col, prop)

I hope you understand my problem, and I’m sorry for my bad english

thanks in advance

Cordialy

Tanguy

Hi @tanguy.belin

do you want the single row to become editable when a user selects a cell inside it?
If so please update this Fiddle http://jsfiddle.net/84em8Lv6/ with the cells, countClick and editIsActive settings

Hi @aleksandra_budnik,

thank you for your quick answer !

http://jsfiddle.net/84em8Lv6/1/

I have edit the fiddle, try to edit without filter : it’s works, after try with the A1 field uncheck and click on the first line.
You will see it’s not working, and if you re-check the A1 field you will see the row who’s readOnly is false.

The issue seems to be connected to this one https://github.com/handsontable/handsontable/issues/4567 as we are using trimRows to handle filtering.

Do you think i have to adapt this kind of code for solve my problem ?

Hi @tanguy.belin

Sorry for a delay. I suppose that you have already tried it.

Hello @aleksandra_budnik,

Sorry for my delay too, I have try somthing like that but i’m not sure it’s the good solution.
Indeed, I need to get the visible physical id of the row when i click on a any cell, actually i get the physical id on filter but with the old visible order …

I hope it’s understandable …

Cordially

Basically, all the indexes in Handsontable are tangled. Some of the callbacks are using visual and some physical indexes.
If you want to get an actual physical index you call toPhysicalColumn and toPhysicalRow and when you have physical indexes and you want to convert them to visual toVisualColumn and toVisualRow.

The problem is solve thanks you very much for your help !

Cordially

Great news. Thank you for updating me.

I guess that we can close the issue.