View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
13441 | Feature requests | Survey taking | public | 2018-03-03 23:12 | 2021-03-10 17:21 |
Reporter | orvil | Assigned To | |||
Priority | none | Severity | @60@ | ||
Status | new | Resolution | open | ||
Summary | 13441: Colums (still) can't be hidden in Array (numbers) questions | ||||
Description | Rows can be hidden by using EM in Array questions. But although there are fields for editing an expressin - or simly 1 or 0 - there is no reaction when the question is displayed. | ||||
Steps To Reproduce | Create a Array (number) question and try to hide a culumn by setting the corresponding EM field to zero | ||||
Additional Information | In the screenshot the two leftmost items should not be visible due to the zeros in the relevance equations | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 40 | ||||
Story point estimate | |||||
Users affected % | |||||
has duplicate | 12277 | confirmed | Bug reports | Relevance equation on column of array-number question doesn't work | |
has duplicate | 15139 | closed | c_schmitz | Feature requests | Array by column relevance equation not working |
has duplicate | 16992 | new | Feature requests | QT SEMICOLON ARRAY MULTI FLEX_ Text problem: there is no problem hiding the whole row, but the whole column is invalid | |
related to | 13739 | closed | Bug reports | Relevance equation broken for array by column |
Can you please attach a 2-question survey demonstrating the issue? |
|
Here it is! |
|
|
|
@cdorin and If you're OK : assing it to me , i think i can do it before november in core. |
|
@DenisChenu: found a solution meanwhile by hiding columns via js (thanks to you addScript plugin!) and this idea you had for a former version of LS. If you are on this issue I'd like to share the code working vor LS 3.18 |
|
@orvil, i already have the javascript for 3.X , but need
I'm happy to have more code for the js part :) Denis |
|
Well, we don't have to have IE10 compatibility. See https://manual.limesurvey.org/Installation_-_LimeSurvey_CE#Browser_compatibility |
|
@DenisChenu: Sounds promising, thats good news :) at 2. yes that's the crucial point I do not find how it is working hideEmptyColumns.js (2,607 bytes)
// function to hide column(s) in array (number) with empty header // remaining columns are stretched to original total width // "table.questions-list" is default to find the input table -- may be this can be defined more accurate? // function hideEmptyColumns(tableIdentifyer = "table.questions-list") { $(tableIdentifyer).each(function(){ var basetable=$(this); var i = 0; var p = 0; var hiddenPos = []; var remainPos = []; var oldWidth = []; var oldWidthPercentages = []; var sumRemainWidth = 0; var sumOldWidth = 0; var stretchFactor = 0; var dummy = ""; // works with thead in LS 3.18 former version worked with col (why?) $(this).find("thead tr.ls-heading th").each(function(){ // save the index of those cols that are to hide and those who remain visible => how to do with valudation? if($.trim($(this).html())===""){ hiddenPos.push(i); } else { remainPos.push(i); } oldWidth.push($(this).width()); i = i + 1; }); // calculate the sum with of all cols as they are without shrink sumOldWidth = oldWidth.reduce(function(a,b){ return a + b; }); // recalculate the old *percentages* of all columns oldWidth.forEach(function(w){ oldWidthPercentages.push(w/sumOldWidth*100); }); // calculate the sum width of only the remaining cols for (p of remainPos) { sumRemainWidth += oldWidth[p -1]; } // calculate the stretch factor stretchFactor = sumOldWidth/sumRemainWidth; // hide all columns with empty header but not col 1 for (p of hiddenPos) { i= p+1; $(tableIdentifyer + " th:nth-child("+ i + ")").hide(); $(tableIdentifyer + " td:nth-child("+ i + ")").hide(); } // refresh the column css width attributes, but let first column as it was dummy = "'" + oldWidthPercentages[0] + "%" + "'"; $(tableIdentifyer + ' col:nth-child(0)').css({ 'width': dummy }); // set hidden cols to 0% p = remainPos.length + 2; for (i of hiddenPos) { $(tableIdentifyer + " col:nth-child(" + p + ")").css({ 'width': '0%' }); p = p + 1; } // stretch visible cols, line title with original width first p = 0; i = 1; dummy = oldWidthPercentages[p] + "%" ; $(tableIdentifyer + " col:nth-child(" + i + ")").css({ 'width': dummy }); // now answer columns p = 2; for(i of remainPos) { dummy = oldWidthPercentages[i] * stretchFactor + "%"; $(tableIdentifyer + " col:nth-child(" + p + ")").css({ 'width': dummy }); p = p + 1; } }); } |
|
Right IE11 :) . And if column are not hidden but relevance is OK on «any browser» it's OK :). Thanks for reminder @c_schmitz About js : https://gitlab.com/SondagesPro/QuestionSettingsType/hideEmptyColumn/blob/master/assets/hideemptycolumn.js i think we can manage more easily with some data attribute in table too :). And usage of event https://github.com/LimeSurvey/LimeSurvey/blob/e838d95655a6e914e6d9bc0285104fe50b93f73f/assets/packages/limesurvey/survey.js#L59 allowing to test if it's a column or a line :) |
|
@DenisChenu: Thanks, these are really nice pieces of code :) I'll check this out in my environment. |
|
giving up |
|
Close ticket? |
|
No, don't close .... The issue still there. Maybe in Feature, not in bug ? |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2018-03-03 23:12 | orvil | New Issue | |
2018-03-03 23:12 | orvil | File Added: Clipboard16.jpg | |
2018-03-08 14:56 | c_schmitz | Assigned To | => c_schmitz |
2018-03-08 14:56 | c_schmitz | Status | new => feedback |
2018-03-08 14:56 | c_schmitz | Note Added: 46948 | |
2018-03-09 22:48 | orvil | File Added: limesurvey_survey_issue13441.lss | |
2018-03-09 22:48 | orvil | Note Added: 47002 | |
2018-03-09 22:48 | orvil | Status | feedback => assigned |
2018-03-29 08:08 | DenisChenu | Relationship added | has duplicate 12277 |
2018-06-04 15:02 | DenisChenu | Relationship added | related to 13739 |
2019-05-21 17:15 | c_schmitz | Product Version | 3.1.x => 3.4.x |
2019-06-24 11:06 | cdorin | Note Added: 52496 | |
2019-08-08 12:21 | DenisChenu | Relationship added | has duplicate 15139 |
2019-08-08 12:23 | DenisChenu | Note Added: 53151 | |
2019-08-08 14:42 | cdorin | Assigned To | c_schmitz => DenisChenu |
2019-09-25 12:35 | orvil | Note Added: 53706 | |
2019-09-25 12:42 | DenisChenu | Note Added: 53707 | |
2019-09-25 12:56 | c_schmitz | Note Added: 53708 | |
2019-09-25 13:25 | orvil | File Added: hideEmptyColumns.js | |
2019-09-25 13:25 | orvil | Note Added: 53709 | |
2019-09-25 15:35 | DenisChenu | Note Added: 53712 | |
2019-09-26 09:33 | orvil | Note Added: 53715 | |
2019-10-25 14:37 | jelo | Issue Monitored: jelo | |
2020-03-02 16:00 | DenisChenu | Assigned To | DenisChenu => |
2020-03-02 16:00 | DenisChenu | Status | assigned => new |
2020-03-02 16:00 | DenisChenu | Note Added: 56275 | |
2020-03-02 16:17 | ollehar | Note Added: 56277 | |
2020-03-02 16:19 | DenisChenu | Note Added: 56278 | |
2021-01-20 08:27 | DenisChenu | Relationship added | has duplicate 16992 |
2021-03-10 17:21 | ollehar | Project | Bug reports => Feature requests |
2022-01-12 10:10 | galads | Bug heat | 36 => 38 |
2022-04-13 15:20 | gabrieljenik | Bug heat | 38 => 40 |