Announcement

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

    adding a record to a sorted grid

    SmartClient Version: v13.0p_2023-08-23/AllModules Development Only (built 2023-08-23)

    Chrome on MacOS

    Hello, I think I succeeded in putting together a test case for what may be a bug (or maybe I'm misinterpreting how the framework should behave). I've got a grid and a form, bound to the same dataSource, where the form is used to add records to the grid. The grid is initially sorted.
    I know the grid will be unsorted after the add, but the behaviour I'm seeing doesn't seem right.

    Please try this test case:

    Code:
    isc.ListGrid.create({
        ID: "dsListGrid",
        width: "100%",
        height: 500,
        autoFetchData: true,
        dataSource: "supplyItem",
        canEdit: true,
        sortField: "itemName"
    });
    
    isc.DynamicForm.create({
        ID: "aForm",
        top: 520,
        dataSource: "supplyItem",
        fields: [
            {name: "itemName"},
            {name: "SKU"},
            {name: "description"},
            {name: "category"},
            {name: "units"},
            {name: "unitCost"},
            {name: "inStock"},
            {name: "nextShipment"},
            {type: "button", click: "aForm.saveData()", title: "Save"}
        ]
    })
    
    aForm.editNewRecord()
    If you add a record, you'll see this add:
    Code:
    {
        dataSource:"supplyItem",
        operationType:"add",
        componentId:"aForm",
        data:{
            nextShipment:"2023-08-24",
            itemName:"test",
            SKU:"324133",
            description:"fdsgsdfg",
            category:"Account Books",
            units:"Roll",
            unitCost:12,
            inStock:true
        },
        textMatchStyle:"exact",
        callback:{
            target:[DynamicForm ID:aForm],
            methodName:"saveEditorReply"
        },
        showPrompt:true,
        prompt:"Saving form...",
        oldValues:{
        },
        requestId:"supplyItem$6277",
        internalClientContext:{
        },
        fallbackToEval:false,
        editor:[DynamicForm ID:aForm],
        lastClientEventThreadCode:"MUP7",
        bypassCache:true,
        dataProtocol:"getParams"
    }
    and this fetch:
    Code:
    {
        dataSource:"supplyItem",
        operationType:"fetch",
        componentId:"dsListGrid",
        data:{
        },
        startRow:0,
        endRow:75,
        textMatchStyle:"substring",
        resultSet:[ResultSet ID:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid)],
        callback:{
            caller:[ResultSet ID:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid)],
            methodName:"fetchRemoteDataReply"
        },
        willHandleError:true,
        showPrompt:true,
        prompt:"Finding Records that match your criteria...",
        oldValues:{
        },
        requestId:"supplyItem$6278",
        internalClientContext:{
            requestIndex:2
        },
        fallbackToEval:false,
        promptStyle:"component",
        lastClientEventThreadCode:"TMR2",
        bypassCache:true,
        dataProtocol:"getParams"
    }
    with INFO level on the ResultSet category I see:

    Code:
    16:47:50.124:XRP8:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):updating cache in place after operationType: add, cached rows: 77, total rows: 3959
    16:47:50.124:XRP8:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):Updating cache: operationType 'add' submitted by 'aForm',1 rows update data
    16:47:50.130:XRP8:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):doSort: sorting on properties [] : directions [] : invalidating cache
    16:47:50.130:XRP8:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):Invalidating cache
    16:47:50.131:XRP8:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):getRange(0, 1) will fetch from 0 to 75
    16:47:50.143:TMR1:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):getRange(0, 31) will fetch from 0 to 75
    16:47:50.150:TMR1:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):getRange(0, 31) will fetch from 0 to 75
    16:47:50.153:TMR2:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):fetching rows 0,75 from server
    16:47:50.416:XRP8:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):Received 75 records from server
    16:47:50.417:XRP8:INFO:ResultSet:isc_ResultSet_2 (dataSource: supplyItem, created by: dsListGrid):cached 75 rows, from 0 to 75 (3960 total rows, 75 cached)
    which seems to confirm the unsort, and the invalidateCache which triggers the fetch.
    The doc mention dropping the cache, but I'm not sure that is right to have this fetch right after the add.
    Moreover it ends with the grid unsorted and the new record out of view, which seems to defeat the purpose of the unsorting.

    #2
    Hello, did you have a chance to look into this?
    The behaviour is still that in latest 12.1, 13.0 and 13.1

    Comment


      #3
      Apologies for the delay with this one - we're getting to it and will update here when we have more information.

      Comment


        #4
        Hello, any news about this issue?

        Comment


          #5
          Hi Claudio
          Sorry for the silence. The answer is that we are still looking into this.
          At this stage it looks like things are not behaving as they should, and we have an engineer investigating exactly why that is.

          We'll follow up with something more substantial as soon as we can

          Paul

          Comment


            #6
            Hello, sorry for being persistent, but is there any update on this issue?

            Comment


              #7
              Hello, any updates on this issue?

              Comment


                #8
                Good heavens, sorry for the silence on this one - we do know what the problem is and a task was assigned to do a deep dive into how it arose, which has since been out-prioritized multiple times.

                We'll try to do it today and get back to you.

                Comment


                  #9
                  hi Claudio - we finally got to this one and it's been fixed for tomorrow's builds, dated November 14 or later.

                  External additions to a grid's DS will no longer invalidate the grid's ResultSet cache and cause an immediate refetch - instead, it will invalidate the ResultSet's row-order and the next request for rows, such as when the grid is scrolled, will invalidate the cache and perform the fetch.

                  Comment


                    #10
                    Thanks, I'm waiting for today's (November 15) as yesterday's 13.0 build didn't show up.

                    Comment


                      #11
                      Hi Claudio - the change hadn't been ported to 13.0, hence the lack of a build yesterday. We've ported it this morning although pretty close to the cut-off time for the build queue - it may still hit 13.0 builds today, but it may be tomorrow.

                      Comment


                        #12
                        SmartClient Version: v13.0p_2023-11-20/Enterprise Deployment (built 2023-11-20)

                        Hello, I can confirm it's fixed, thank you very much!

                        Comment

                        Working...
                        X