make CellSelection work with tree mode

when CellSelection is used with tree mode, shift-click cell in different row would lead to js exception

this pull request is my proposed patch