paging grids

Certified Senior Developer

hello all,

I am using paging grid and also user can filter based on drop down. Drop down values are dynamically load from view(distinct dept names will be in dropdown if data is available for that id record).If there are records , grid is working fine(pageinfo 1,5). If there is no record for the particular Id then I am getting the below message. Please let me know if you have any thoughts.Thanks

“totalCount” must not be null or less than the number of items in any of the “data” arrays, but “totalCount” was 0 and the largest column data array had 1 items

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    It's not very useful to speculate further until/unless supplies us with example code as originally requested, since there could be so many possibilities.

    However since everyone else already is, i'll post mine:

    My biggest suspected culprit here is that the data elements of the columns are not properly handling the empty set condition, which is a common mistake i've seen with SAIL designers who are new to paging grids.

    This would be caused by defining the data element like:

    data: property(local!dataSubset.data, "myElement", null)

    This would cause the error message as described in the original post since when the dataSubset returns an empty Data array, the 'null' would return one element instead of an empty set.  The proper way of writing this (and this should be everyone's default setup for paging grid columns until/unless something more complex is required) is as follows:

    data: property(local!dataSubset.data, "myElement", {})
Reply
  • 0
    Certified Lead Developer

    It's not very useful to speculate further until/unless supplies us with example code as originally requested, since there could be so many possibilities.

    However since everyone else already is, i'll post mine:

    My biggest suspected culprit here is that the data elements of the columns are not properly handling the empty set condition, which is a common mistake i've seen with SAIL designers who are new to paging grids.

    This would be caused by defining the data element like:

    data: property(local!dataSubset.data, "myElement", null)

    This would cause the error message as described in the original post since when the dataSubset returns an empty Data array, the 'null' would return one element instead of an empty set.  The proper way of writing this (and this should be everyone's default setup for paging grid columns until/unless something more complex is required) is as follows:

    data: property(local!dataSubset.data, "myElement", {})
Children
  • 0
    Certified Senior Developer
    in reply to Mike Schmitt

    Thanks for looking into this.. sorry for sending the late response.. I added the if condition to validate the total count before populating the grid. After adding this check, I didn't see the error message, Please let me know if any have different thoughts. I have to edit lot of info in the code before pasting the code here. so posted here pseudo code .Also I handled null condition in my grid using {}.Thanks.again ..

     

    below is the logic I used.

     

    if((local!task.totalCount) > 0,{
           a!dropdownField(

       ....

    },

    {

    a!textField( label: "No Records Available")

    })

     

     

  • 0
    Certified Lead Developer
    in reply to baratc
    Hi it's difficult to trace out this issue unless we dont have a look on the datasubset sample (when it's throwing an error and the datasubset sample when it's working fine)

    Also configuration of pagingGrid such as value, saveInto, totalCount etc.