Announcement

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

    Defining max records to return for filterData on a ListGrid

    We would like to give users the ability to define the number of rows to return when calling grid.filterData(). So, if the filter condition they configure returns a total of 25 rows but they only want to see the top 10, we could pass a max param to filterData. How would this be possible?

    #2
    Pass it as dsRequest.endRow via the dsRequest Properties argument to filterData(), and also set an operationId that you detect in your server code and use to set totalRows = endRow so that the grid does not try to request additional rows.

    Comment


      #3
      We are actually trying to do this with client-side filtering. So, our current filter doesn't pass a dsRequest to filterData at all. If we create a dsRequest object and pass it with endRows client-side, will that work?

      Comment


        #4
        Could you be more specific - is there a DataSource involved? What kind?

        Comment


          #5
          There is a datasource. But, this particular use case is where we fetch data from the server and then do additional filtering that is purely client-side. So, if 100 rows come back from the server, we give the user the ability to filter them down to 25 with the filters they configure and then we want to give them the ability to define a max param to get down to 10 client-side. Does that make sense?

          Comment


            #6
            It makes sense. So again what kind of DataSource is this - clientOnly, dataProtocol:clientCustom, cacheAllData:true, something else?

            Comment


              #7
              It is a normal datasource we use for server operations. No special protocols. Here is what the logic looks like. We fetch data from the server and create a local ResultSet and call setData on the grid and then call filterData on the grid to filter further. So, looking for a way to pass in an endRow or max param into that filterData call....

              Code:
              	  var faResultSet = isc.ResultSet.create({
              	   		dataSource: FA,
              			initialData: serverData,
              			allRows:serverData,
              			useClientFiltering:true,
              			criteria:serverRequestCriteria,
              			neverDropUpdatedRows:true
              			});
              	
              
              
              	faGrid.setData(faResultSet);
              
              	faGrid.filterData(clientFilterCriteria);

              Comment


                #8
                The easiest thing is probably to switch from calling filterData() on the grid to calling setCriteria() on the ResultSet, then providing the first 10 rows from the ResultSet to the grid. Something like:

                Code:
                faResultSet.setCriteria(clientFilterCriteria);
                faGrid.setData(faResultSet.getRange(0,10));

                Comment

                Working...
                X