jQWidgets Forums

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Optional data field's mapping Optional data field's mapping #63145

    fjean
    Participant

    We found a similar problem which seem to be working fine with when using json a data but is not working when using observablearray for aour data source.

    First case , mapping comment text when comment isnt defined at all in data source, working as intended :
    http://jsfiddle.net/sGGZ3/164/

    Code :

    var data = ko.observableArray( [
    { id: 100} ,
    { id: 101 , comment : {text : “toto” }},
    { id: 102 }
    ]);
    // prepare the data
    var source =
    {
    datatype: “observablearray”,
    datafields: [
    { name: ‘id’, type: ‘number’},
    { name: ‘commenttext’ , map : ‘comment>text’}
    ],
    localdata: data
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxgrid”).jqxGrid(
    {
    width: 300,
    source: dataAdapter,
    columns: [
    { text: ‘Id’, datafield: ‘id’ },
    { text: ‘Comment’, datafield: ‘commenttext’ }
    ]
    });

    ——————————————————————————————————————-
    Second case mapping comment text when comment is set to null in datasource :
    http://jsfiddle.net/sGGZ3/165/

    var data = ko.observableArray( [
    { id: 100 , comment : null} ,
    { id: 101 , comment : {text : “toto” }},
    { id: 102 }
    ]);
    // prepare the data
    var source =
    {
    datatype: “observablearray”,
    datafields: [
    { name: ‘id’, type: ‘number’},
    { name: ‘commenttext’ , map : ‘comment>text’}
    ],
    localdata: data
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxgrid”).jqxGrid(
    {
    width: 300,
    source: dataAdapter,
    columns: [
    { text: ‘Id’, datafield: ‘id’ },
    { text: ‘Comment’, datafield: ‘commenttext’ }
    ]
    });

    Getting error : Uncaught TypeError: Cannot read property ‘text’ of null. I think it is a bug because the behavior of mapping is not constant between datasource datatype (json vs observablearray) and the fact that an undefined comment (which work) conceptually is the same as setting comment : null

    in reply to: jqxgrid and knockback jqxgrid and knockback #62402

    fjean
    Participant

    Well re=phrasing my problem it seem that there is problem if the row data object isinitialized from a constructor.

Viewing 2 posts - 1 through 2 (of 2 total)