SPServices
SPServices copied to clipboard
SPArrangeChoices is skipping the first (perRow-1) # of items !
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.
Ok, thank you. I don’t have a dev environment but I’ll look into it.
Brendan
On Dec 26, 2017, 11:17 AM -0500, Paul T. [email protected], wrote:
@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. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
BTW: where did you fix the problem? In a file under the dist
folder?
The source is kept under the src
folder. If you applied your fix to the built non-minimized version under the dist
folder, then doing a build will not help you - your fix will not be picked up.
/Paul
-- sent from mobile
I modified the file on my computer, not within Github.
Brendan
On Dec 30, 2017, 2:23 PM -0500, Paul T. [email protected], wrote:
BTW: where did you fix the problem? In a file under the
dist
folder? The source is kept under thesrc
folder. If you applied your fix to the built non-minimized version under thedist
folder, then doing a build will not help you - your fix will not be picked up./Paul
-- sent from mobile — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
Sounds like you just changed the built non-minimized file. If all you want is a minimized version, then just use an online minifier site, like this one: https://jscompress.com/ Just copy your changed file to it and it will minify it for you.
If you would like contribute your fix back, then it's best to checkout the source and then make the change to the appropriate files under the src
folder.
Paul
-- sent from mobile