SPArrangeChoices is skipping the first (perRow-1) # of items !
pankajdarure opened this issue · comments
Hi Marc @sympmarc,
I am a great fan of your work!
When the 2014.02 was released with the fix for "choices not being saved during the page postback", the new issue started coming up i.e. initial perRow-1 number of items are getting skipped when the checkboxes are rearranged! e.g. if we want 4 checkboxes in each row then first (4-1) i.e. 3 options will be skipped!
I guess some users have reported this bug for SP2013 and some have for SPOnline, but I think this happens even for SP2010!
Upon adding a bunch of alerts, I figured out why this is happening!
In the source code, at line 3230, when you build the newChoiceTable, the first <tr>
is added only when the first "closing off the row" takes place and until then there is not "tr" hence the newChoiceTable.find("tr:last").append(columnOptions[i]);
line does nothing!
So,
I've made a slight change (in my personal/local copy) in that "if" condition to take care of initial/first "tr" (when i===0) and also to avoid the premature insertion of <tr></tr>
.
All you need to do is, change the line 3230 as below and it will start working fine again!
//if ((i + 1) % opt.perRow === 0) {//Original
if (i % opt.perRow === 0) {//Fixed
Hope it helps! If it does, please feel free to implement this fix in your next build :)!!
Pankaj
I was experiencing the same issue and this fixed it. Any idea of how to fix it in the minified version?
@Murphybp2 - if you have setup a dev environment (see README file), then you should be able to do run gulp
command... Look like it will build everything including the minified version.