1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    146
    Vote Rating
    0
    rahulmca1@gmail.com is on a distinguished road

      0  

    Default Array Grid Bug(data in grid column gets truncated)

    Array Grid Bug(data in grid column gets truncated)


    Hi,

    Found a bug in array grid

    Explaination:--
    Using
    YUI-Ext array grid example:--


    // some data yanked off the web
    var myData = [
    ['one<two','three<four','five<six','seven<eight','nine<ten']
    ];
    var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
    // sortTypes provide support for custom sorting comparison functions
    // not needed for this table but here for demonstration
    var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;

    // the DefaultColumnModel expects this blob to define columns. It can be extended to provide
    // custom or reusable ColumnModels
    var colModel = new YAHOO.ext.grid.DefaultColumnModel([
    {header: "Company", width: 200, sortable: true, sortType: sort.asUCString},
    {header: "Price", width: 75, sortable: true},
    {header: "Change", width: 75, sortable: true},
    {header: "% Change", width: 75, sortable: true},
    {header: "Last Updated", width: 85, sortable: true}
    ]);

    // create the Grid
    var grid = new YAHOO.ext.grid.Grid('example-grid', dataModel, colModel);
    grid.render();

    grid.getSelectionModel().selectFirstRow();


    I used data model
    var myData = [
    ['one<two','three<four','five<six','seven<eight','nine<ten']
    ];

    But in the grid it displayed truncated names as following grid row:--

    one three five seven nine

    thus truncating <two from is column and similar result in other columns.


    thanks.
    with regards

  2. #2
    Ext User
    Join Date
    Mar 2007
    Posts
    146
    Vote Rating
    0
    rahulmca1@gmail.com is on a distinguished road

      0  

    Default Array grid problem

    Array grid problem


    Hi,

    Found a bug in array grid

    Explaination:--
    Using
    YUI-Ext array grid example:--


    // some data yanked off the web
    var myData = [
    ['one<two','three<four','five<six','seven<eight','n ine<ten']
    ];
    var dataModel = new YAHOO.ext.grid.DefaultDataModel(myData);
    // sortTypes provide support for custom sorting comparison functions
    // not needed for this table but here for demonstration
    var sort = YAHOO.ext.grid.DefaultColumnModel.sortTypes;

    // the DefaultColumnModel expects this blob to define columns. It can be extended to provide
    // custom or reusable ColumnModels
    var colModel = new YAHOO.ext.grid.DefaultColumnModel([
    {header: "Company", width: 200, sortable: true, sortType: sort.asUCString},
    {header: "Price", width: 75, sortable: true},
    {header: "Change", width: 75, sortable: true},
    {header: "% Change", width: 75, sortable: true},
    {header: "Last Updated", width: 85, sortable: true}
    ]);

    // create the Grid
    var grid = new YAHOO.ext.grid.Grid('example-grid', dataModel, colModel);
    grid.render();

    grid.getSelectionModel().selectFirstRow();


    I used data model
    var myData = [
    ['one<two','three<four','five<six','seven<eight','n ine<ten']
    ];

    But in the grid it displayed truncated names as following grid row:--

    one three five seven nine

    thus truncating <two from is column and similar result in other columns.

    Waiting for your response.
    thanks.
    with regards

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Try using &lt; instead of <

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    EDIT: deleted other copy of this thread.

  5. #5
    Ext User
    Join Date
    Mar 2007
    Posts
    146
    Vote Rating
    0
    rahulmca1@gmail.com is on a distinguished road

      0  

    Default


    Hi,

    In my case data is populated from database so what should I do Should I look for '<' sign in every column value of the row of array grid and then scan every value for '<' character and replace it accordingly.

    For huge data populated from database it would be very costly operation.

    Why any characters after '<' symbol are truncated?

    When using '>' or '<>' it works fine.


    Thanks
    With Regards

  6. #6
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    this isn't a bug.

    since you didn't specifiy custom renderers in your ColumnModel, default renderers are used:
    Code:
    Ext.grid.ColumnModel.defaultRenderer = function(value){
    	if(typeof value == "string" && value.length < 1){
    	    return " ";
    	}
    	return value;
    };
    1. the default renderer spits out whatever it sees
    2. so "<" marks the beginning of an opening HTML tag
    3. so "<two", "<four" and "<six" become invalid HTML tags which get ignored by the browser

    I suggest you inspect your generated page in FireBug. Just specify a custom renderer, or return HTML escaped characters from your database, and your problem is solved.

Thread Participants: 3