0

我正在尝试在我有事件的每一天在完整日历中添加一个 moreLink,并且我想在更多链接中强制显示当天的所有事件!

这是我选择的解决方案,因为事件的标题很长,不适合平板电脑或手机屏幕!

到目前为止,我在只有一个事件的日子里没有成功,因为函数 computeRowLevelLimit 返回 false!

我对任何对我有帮助的疯狂想法持开放态度,但请记住,我是一名 Java 开发人员,对 js 的了解最少,如果可能,请添加一些额外的信息

4

1 回答 1

0

因为我有压力,所以我自己处理了这件事,所以这是解决方案

here i added the last else in order to be able to execute 2 methods when levelLimit is false

limitRows: function (levelLimit) {
            var rowStructs = this.eventRenderer.rowStructs || [];
            var row; // row #
            var rowLevelLimit;

            for (row = 0; row < rowStructs.length; row++) {
                this.unlimitRow(row);

                if (!levelLimit) {
                    rowLevelLimit = false;
                }
                else if (typeof levelLimit === 'number') {
                    rowLevelLimit = levelLimit;
                }
                else {
                    rowLevelLimit = this.computeRowLevelLimit(row);
                }

                if (rowLevelLimit !== false) {
                    this.limitRow(row, rowLevelLimit);
                } else {
                    this.unlimitRow2(row);
                    this.addMoreLink(row);
                }

            }
        },

The added metod are: 
   - one for clearing the existing links 
   -  second for adding new links - remember this is for days with only one event

the methods are the following:

unlimitRow2: function (row) {
            var rowStruct = this.eventRenderer.rowStructs[row];

            var cellMatrix;
            var oneDayCell;
            cellMatrix = rowStruct.cellMatrix;
            var _this = this;

            for (i = 0; i < cellMatrix.length; i++) {
                // console.log("celmatrix ", cellMatrix[i]);
                oneDayCell = cellMatrix[i];
                console.log("outati", oneDayCell)

                if (oneDayCell.moreEls) {
                    oneDayCell.moreEls.remove();
                    oneDayCell.moreEls = null;
                }

                if (oneDayCell.limitedEls) {
                    oneDayCell.limitedEls.removeClass('fc-limited');
                    oneDayCell.limitedEls = null;
                }
            }
        },

and, 

addMoreLink: function (row) {
            // console.log("inside addMoreMethod", row);
            var rowStruct = this.eventRenderer.rowStructs[row];
            var cellMatrix;
            var oneDayCell;
            var coloana;
            var nrCol;
            var td, moreWrap, moreLink;
            var moreNodes = [];
            var segsBelow;
            // console.log ("structura randului", rowStruct);
            cellMatrix = rowStruct.cellMatrix;
            var _this = this;

            for (i = 0; i < cellMatrix.length; i++) {
                // console.log("celmatrix ", cellMatrix[i]);
                oneDayCell = cellMatrix[i];
                for (j = 0; j < oneDayCell.length; j++) {
                    coloana = oneDayCell[j];
                    nrCol = j;
                    segsBelow = _this.getCellSegs(row, nrCol);

                    console.log($(coloana));
                    moreLink = _this.renderMoreLink(row, nrCol, segsBelow);
                    moreWrap = $('<div/>').append(moreLink);
                    coloana.append(moreWrap);
                    moreNodes.push(moreWrap[0]);

                    // rowStruct.limitedEls = $(limitedNodes);
                }
                rowStruct.moreEls = $(moreNodes); // for easy undoing later
            }
        },

and for the rest i manipulated a litle bit limitRow: function (row, levelLimit)

also i had to hide the text and i choose a nasty method, not proud of it but ...

in getMoreLinkText(num) i added a last else if 

else if (num === 0 ){
                return '';
            }
于 2017-10-15T21:49:11.713 回答