Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPArrangeChoices is skipping the first (perRow-1) # of items ! #62

Open
pankajdarure opened this issue Aug 24, 2017 · 6 comments
Open

Comments

@pankajdarure
Copy link

pankajdarure commented Aug 24, 2017

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

@Murphybp2
Copy link

I was experiencing the same issue and this fixed it. Any idea of how to fix it in the minified version?

@purtuga
Copy link
Collaborator

purtuga commented Dec 26, 2017

@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.

@Murphybp2
Copy link

Murphybp2 commented Dec 30, 2017 via email

@purtuga
Copy link
Collaborator

purtuga commented Dec 30, 2017 via email

@Murphybp2
Copy link

Murphybp2 commented Dec 30, 2017 via email

@purtuga
Copy link
Collaborator

purtuga commented Dec 30, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants