Slick Grid 2 grids displayed, losing focus on seco

2019-08-20 07:16发布

I have been using slick grid, which is excellent, but have a really minor niggling issue which I can't seem to halt.

I display two grids, one is editable and as items are 'Approved' they are then moved to the second grid, which is read-only.

All good so far... But whilst Testing it has become apparent that when clicking on cells within the second grid which have checkboxes in them the focus gets reset to the first grid if the checkbox is clicked within the cell. If they click anywhere else it doesn't do anything, but if the checkbox is clicked it shifts focus. It doesn't change the value, but it does shift focus away. If I remove the formatter it doesn't shift focus...

Any ideas?

Should I be looking at some sort of custom formatter?

I can supply screenshots or code if needed. Both grids are independently defined. They work really well apart from this minor issue which seems to be because the checkbox (read only, no editor) is clicked on. Clicking anywhere else in that cell or on other cells does nothing.

I've tried processing a beforeEdit event and ignoring that. Just wondering if there's something I'm missing. There probably is!

Thanks

标签: grid slick
1条回答
神经病院院长
2楼-- · 2019-08-20 08:06

(Posted on behalf of the OP).

I solved it using a custom formatter :

function customFormatter(row,cell,value,columnDef, dataContext) {

    console.log('value '+ value);

    if(value == true)
    {
    return "<input type='checkbox' onclick='return false;' id='coding' name='interest' value='coding' checked>"
    }
    else
    {
    return "<input type='checkbox' onclick='return false;' id='coding' name='interest' value='coding'>"
    }

}

Checkboxes are still displayed but they don't make the second grid lose focus to the first grid :)

查看更多
登录 后发表回答