javascriptdojoescapingdojo.gridx

HTML escaping in GridX


Does GridX support HTML escaping for texts in cells?

I've failed to find the attribute like escapeHTMLInData from dojox.grid.DataGrid.

Does GridX has built-in HTML escaping, or one need to write a module for that, evt. manually escape the text fields before setting them in grid?


Solution

  • GridX, from version 1.3, has build-in HTML escaping, which is activated by parameter encode: true to the grid structure:

    var structure = [
        { id: 'name', field: 'name', name: 'Name', encode: true},
        { id: 'city', field: 'city', name: 'City', encode: true},
        { id: 'score', field: 'score', name: 'Score}
    ];
    
    var grid = Grid({
          id: 'grid',
          cacheClass: Cache,
          store: store,
          structure: structure
    });