Issue Bug Closed

#58142Backend layout, empty colpos breaks JS

Philipp Gampe 04/23/14, 23:07 updated 06/20/14, 08:17

Description

Consider the following TS:

backend_layout {
    colCount = 3
    rowCount = 3
    rows {
        1 {
            columns {
                1 {
                    name = Top left
                }
                2 {
                    name = top middle 0
                    colPos = 0
                }
                3 {
                    name = top right 1
                    colPos = 1
                }
            }
        }
        2 {
            columns {
                1 {
                    name = middle left 2
                    colPos = 2
                }
                2 {
                    name = middle middle 3
                    colPos = 3
                }
                3 {
                    name = middle right 4
                    colPos = 4
                }
            }
        }
        3 {
            columns {
                1 {
                    name = lower left
                    colPos = 5
                }
                2 {
                    name = lower middle -1
                    colPos = -1
                }
                3 {
                    name =
                    colPos =
                }
            }
        }
    }
}

This results in the following JS:

t3Grid = new TYPO3.Backend.t3Grid({
                data: [[{colspan:1,rowspan:1,name:'Top left'},{colspan:1,rowspan:1,name:'top middle 0',column:0},{colspan:1,rowspan:1,name:'top right 1',column:1}],[{colspan:1,rowspan:1,name:'middle left 2',column:2},{colspan:1,rowspan:1,name:'middle middle 3',column:3},{colspan:1,rowspan:1,name:'middle right 4',column:4}],[{colspan:1,rowspan:1,name:'lower left',column:5},{colspan:1,rowspan:1,name:'lower middle -1',column:-1},{colspan:1,rowspan:1,name:'',column:}]],
                colCount: 3,
                rowCount: 3,
                targetElement: 'editor'
            });

This is invalid, because the column:} must be column:''}.

Removing the empty colPos = statements makes the JS valid again, because the column property is not rendered.

Solution, check for empty colPos and cast this to a string.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.