angular-ui / ui-grid

UI Grid: an Angular Data Grid
http://ui-grid.info
MIT License
5.39k stars 2.47k forks source link

Cannot read property 'colDef' of undefined with pinned column #3935

Open Havock94 opened 9 years ago

Havock94 commented 9 years ago

Hi, I would like to report an issue with column pinning. It looks like sometimes (I can't reproduce the issue whenever i want) the pinned column becomes all white (until I scroll the grid, then all the values come out) and if I try to resize this column it gives me the error Cannot read property 'colDef' of undefined at ui.grid.min.js:12 (I couldn't find where the error is with the unminified version)

I had to unpin and then pin the column again to make it work. I'm sorry I can't provide you more details, but I hope this report can still help you.

chyzwar commented 9 years ago

Try to add enableColumnResizing: true in you column definition.

Havock94 commented 9 years ago

Hi, thank you for your reply. Unfortunately I already have the column resize enabled.

chyzwar commented 9 years ago

Yes but you might need to try to add that in column definition not in grid options.

2015-07-15 15:57 GMT+01:00 Havock94 notifications@github.com:

Hi, thank you for your reply. Unfortunately I already have the column resize enabled.

— Reply to this email directly or view it on GitHub https://github.com/angular-ui/ng-grid/issues/3935#issuecomment-121643263 .

JoeBentley63 commented 9 years ago

Hi, also have this problem, i tried adding it as you say to the column definitions, so it looks something like : {name: 'some column name', enableColumnResizing: true}

still getting this exception :sob:

leelakrish commented 8 years ago

This can be fixed by changing the findTargetCol method. if the position is left and colIndex is "0" then we need to return the "0"th element, instead of multiplying with -1 and rtlMultiplier. Please let me know if the below code fix.

findTargetCol: function(col, position, rtlMultiplier){ var renderContainer = col.getRenderContainer(); if (position === 'left') { // Get the column to the left of this one var colIndex = renderContainer.visibleColumnCache.indexOf(col); if(colIndex === 0){ return renderContainer.visibleColumnCache[0]; } return renderContainer.visibleColumnCache[colIndex - 1 * rtlMultiplier];
} else { return col; } }

abhi08638 commented 7 years ago

Same issue in v4.0.6, re-adding the code above fixed it for me