Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid problem with Long pks

    1. SmartClient Version: v8.3_2012-11-20/EVAL Deployment
    2. all browsers

    Hello.

    I am evaluating smartgwt ee (JPADataSource) and stuck with an error: wrong values of pks (java.lang.Long type) for the next datasource
    Code:
    {
        ID:"MockItem_JPA", 
        serverType:"jpa", 
        fields:[
            {
                primaryKey:true, 
                name:"id", 
                length:255, 
                canEdit:true, 
                required:true, 
                type:"integer"
            }, 
            {
                name:"system", 
                length:255, 
                canEdit:true, 
                required:true, 
                type:"boolean"
            }, 
            {
                name:"name", 
                length:1200, 
                canEdit:true, 
                required:false, 
                type:"text"
            }, 
            {
                name:"code", 
                length:50, 
                canEdit:true, 
                required:false, 
                type:"text"
            }, 
            {
                name:"shortname", 
                length:255, 
                canEdit:true, 
                required:false, 
                type:"text"
            }
        ], 
        dropExtraFields:true, 
        allowAdvancedCriteria:true
    }
    It seems that ther is an error in calculating client 'integer' values. While performing fetch data client receive the next response from the server
    Code:
    //isc_RPCResponseStart-->[{data:[{id:1301161815003900001},{id:1301170936003900002},{id:1301171716003900001}],endRow:3,invalidateCache:false,isDSResponse:true,operationType:"fetch",queueStatus:0,startRow:0,status:0,totalRows:3}]//isc_RPCResponseEnd
    At the same time the content of DSResponse is
    Code:
    [
        {
            data:[
                {
                    id:1301161815003900000
                }, 
                {
                    id:1301170936003900000
                }, 
                {
                    id:1301171716003900000
                }
            ], 
            endRow:3, 
            invalidateCache:false, 
            isDSResponse:true, 
            operationType:"fetch", 
            queueStatus:0, 
            startRow:0, 
            status:0, 
            totalRows:3
        }
    ]
    As you see the last digits of numbers are lost in DSResponse. Please, tell me what I'm doing wrong!

    #2
    Those numbers are too large for JavaScript's Number type. Try running the following code:

    Code:
    eval("1301161815003900001")
    Result: 1301161815003900000

    You should deliver those PK values as Strings instead to avoid this issue.

    Comment

    Working...
    X