Skip to main content
kavyan471063
Known Participant
Feb 15, 2022 7:01 AM UTC
Question

Sorting and pagination not working

Hi All,

I am using a parent UI where 2 gridField and 1 gridRowLayout is used. First gridfield is working fyn. GridRowLayout will receive user input and based on that input the second gridfield will filter and display grids. Initially I created that within parent UI but the pagination and sorting is not working. I tried it in a new child UI sorting and pagination is working but its querying all the data , not the filter from the user input. Help me guys. Thanks in advance.

    6 replies

    richardm900458
    Inspiring
    Feb 15, 2022 7:15 AM UTC

    Hi kavynatrajan,
    can you share youre code with us?
    We cannot see the concrete issue without checking where are you at.


    kavyan471063
    Known Participant
    Feb 15, 2022 7:21 AM UTC

    load(
      local!save,
      local!change: rule!SIMPL_QE_getRefCompanyData(
        selectedUser: {
          ri!selectedUserId
        }
      ).active,
      local!gpvUserCompany,
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 10
      ),
      with(
        local!count: count(
          rule!SIMPL_QE_getRefCompanyData(
            selectedUser: {
              ri!selectedUserId
            }
          )
        ),
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                rule!SIMPL_readOnlyGridForGPVUserCompany(
                  gpvUserCompany: ri!gpvUserCompany,
                  totalCount: ri!totalCount,
                  gpvUserCompany1: ri!gpvUserCompany1
                ),
                a!richTextDisplayField(
                  value: {
                    a!richTextItem(
                      text: "Add New User Company",
                      link: a!dynamicLink(
                        label: "Add New User Company",
                        value: 'type!{urn:com:appian:types}SIMPL_Gpv_User_Company'(
                          created_on: today(),
                          created_by: rule!APN_displayUser(
                            loggedInUser()
                          ),
                          last_modified_on: now(),
                          last_modified_by: rule!APN_displayUser(
                            loggedInUser()
                          )
                        ),
                        saveInto: {
                          a!save(
                            ri!gpvUserCompany1,
                            append(
                              ri!gpvUserCompany1,
                              save!value
                            )
                          ),
                          a!save(
                            local!save,
                            true
                          )
                        }
                      )
                    )
                  }
                ),
                rule!SIMPL_EGRID_userCompany(
                  gpvUserCompany: ri!gpvUserCompany,
                  selectedUserId: ri!selectedUserId,
                  totalCount: ri!totalCount,
                  companyNames: ri!companyNames,
                  selectedIndex: ri!selectedIndex,
                  gpvUserCompany1: ri!gpvUserCompany1,
                  change: ri!change
                ),
                with(
                  local!query: rule!SIMPL_QE_getRefCompanyData(
                  selectedUser: {
                    ri!selectedUserId
                  }
                ),
        local!datasubset1: todatasubset(
          local!query,
          local!pagingInfo
        ),
        local!data1: index(
          local!datasubset1,
          "data",
          {}
        ),
        {
           rule!SIMPL_idQueriedReadOnlyGrid(
                  selectedUserId: ri!selectedUserId,
                  gpvUserCompany: local!query
                  /*gpvUserCompany1: ri!gpvUserCompany1*/
                )
          /*a!gridField(*/
                  /*totalCount:local!count,*/
                  /*identifiers:index(local!datasubset1,"identifiers",{}),*/
                  /*columns: {*/
                    /*a!gridTextColumn(*/
                      /*label: "UserName",*/
                      /*field: "user_id",*/
                      /*data: index(*/
                        /*local!data1,*/
                        /*"user_id",*/
                        /*{}*/
                      /*)*/
                    /*),*/
                    /*a!gridTextColumn(*/
                      /*label: "First name",*/
                      /*field: "user_firstname",*/
                      /*data: index(*/
                        /*local!data1,*/
                        /*"user_firstname",*/
                        /*{}*/
                      /*)*/
                    /*),*/
                    /*a!gridTextColumn(*/
                      /*label: "Last name",*/
                      /*field: "user_lastname",*/
                      /*data: index(*/
                        /*local!data1,*/
                        /*"user_lastname",*/
                        /*{}*/
                      /*)*/
                    /*),*/
                    /*a!gridTextColumn(*/
                      /*label: "Company Name",*/
                      /*field: "company_id",*/
                      /*data: a!forEach(*/
                        /*items: index(*/
                          /*local!data1,*/
                          /*"company_id",*/
                          /*{}*/
                        /*),*/
                        /*expression: {*/
                          /*rule!SIMPL_GPV_decisionRuleForCompanyNames(*/
                            /*company_id: fv!item*/
                          /*)*/
                        /*}*/
                      /*)*/
                    /*),*/
                    /*a!gridTextColumn(*/
                      /*label: "Creation date",*/
                      /*field: "created_on",*/
                      /*data: a!forEach(*/
                        /*items:index(local!data1,"created_on",{}),*/
                        /*expression: text(*/
                        /*fv!item,*/
                        /*"mmm dd,yyyy"*/
                      /*)*/
                      /*)*/
    /*                 */
                    /*),*/
                    /*a!gridTextColumn(*/
                      /*label: "Created by",*/
                      /*field: "created_by",*/
                      /*data: index(*/
                        /*local!data1,*/
                        /*"created_by",*/
                        /*{}*/
                      /*)*/
                    /*),*/
                    /*a!gridImageColumn(*/
                      /*label: "Active?",*/
                      /*field: "active",*/
                      /*data: a!forEach(*/
              /*items: index(local!data1, "active", {}),*/
              /*expression:load(*/
                /*local!changes:toboolean(fv!item),*/
                /*a!documentImage(*/
                  /*document: a!iconIndicator(*/
                    /*icon: if(*/
                      /*local!changes,*/
                      /*"STATUS_OK",*/
                      /*"STATUS_NOTDONE"*/
                    /*)*/
                  /*),*/
                  /*caption: if(local!changes, "Yes", "No"),*/
                  /*link: a!dynamicLink(*/
                    /*label: "change",*/
                    /*value: not(local!changes),*/
                    /*saveInto: { local!changes ,*/
                    /*a!save(ri!gpvUserCompany[fv!index],updatecdt(local!data1[fv!index],{active:local!changes})),*/
                    /*a!writeToDataStoreEntity( dataStoreEntity: cons!SIMPL_DSE_USER_COMPANY,*/
                /*valueToStore: ri!gpvUserCompany)*/
                    /*}*/
                  /*)*/
                /*)*/
              /*)*/
            /*))*/
                  /*},*/
                  /*value: local!pagingInfo,*/
                  /*saveInto: {*/
                    /*local!pagingInfo,*/
                    /*a!save(local!datasubset1,todatasubset(local!query,local!pagingInfo)),*/
                    /*a!save(local!data1,index(local!datasubset1,"data",{}))*/
                  /*},*/
                  /*showWhen: not(isnull(ri!selectedUserId))*/
                /*)*/
        }
               
                )
              }
            )
          }
        )
      )
    )

    For this code, the querying problem is there like it is not querying the selected user id.

    Like this. If I give whole code in the parent UI instead of child UI, Sorting and pagination is not working.

    It is throwing this error.

    richardm900458
    Inspiring
    Feb 15, 2022 7:25 AM UTC

    1.) Why are you using load() and with(). They are old and outdated.

    2.) can you insert the code of your used rules as well?
    I have a concrete idea what the issue might be, but for that the used rules has to be checked. Especially " rule!SIMPL_readOnlyGridForGPVUserCompany()"