Announcement

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

    Problem with grid filter

    Hello,

    I have a list grid of persons with a data source and I have enabled the filter editor.

    Now I want to filter persons, for example show me all persons with the first name John. This works well, but only in the case, when not all rows are loaded in the grid.

    This means when the number of data is so low, that all data is displayed with one paging, like in the below JSON. In this case, the Johns will not be shown.
    Only the message: "No items to show"

    Also when I scroll through a huge number of rows and they are after that all loaded into the grid, then the Johns are not shown as well.

    But when only a part of the rows are loaded, all filtered Johns are shown correctly.

    What have I done wrong? How could I filter rows also in a completely loaded grid?

    Regards Thomas

    Grid Code:
    Code:
    isc.ListGrid.create(
        {
         "ID":"personsListGrid_6",
         "selectionChanged":function (p1, p2) {selectionChangedTransportEvent(this, "6", "4", null ,p1, p2); },
         "recordDoubleClick":function (p1, p2, p3, p4, p5, p6, p7) {recordDoubleClickTransportEvent(this, "6", "5", "Loading" ,p1, p2, p3, p4, p5, p6, p7); },
         "selectionType":"multiple",
         "timeFormatter":"toShortTime",
         "sortField":"lastnameField",
         "sortDirection":"ascending",
         "showFilterEditor":true,
         "autoFetchTextMatchStyle":"startsWith",
         dataSource:isc.DataSource.create(
          {
           "fields":
           [
            {
             "name":"generatedIndex",
             "primaryKey":true,
             "hidden":true,
             "canEdit":false,
             "canSort":false,
             "valueMap":
             {
             }
            },
            {
             "name":"lastnameField",
             "title":"Name",
             "type":"text",
             "width":250,
             "canEdit":false,
             "canSort":true,
             "hoverHTML":"return 'The employees family name(s).'",
             "showHover":true
            },
            {
             "name":"firstnameField",
             "title":"First name",
             "type":"text",
             "width":150,
             "canEdit":false,
             "canSort":true,
             "hoverHTML":"return 'The employees Christian name(s).'",
             "showHover":true
            },
            {
             "name":"personelNumberField",
             "title":"Personnel number",
             "type":"text",
             "width":150,
             "canEdit":false,
             "canSort":true,
             "hoverHTML":"return 'Unique personnel number. Usually defined by payroll.'",
             "showHover":true
            },
            {
             "name":"userIdField",
             "title":"User-ID",
             "type":"text",
             "width":150,
             "canEdit":false,
             "canSort":true,
             "hoverHTML":"return 'Unique criterion which the employee uses to log-in to HRworks.'",
             "showHover":true
            },
            {
             "name":"organizationUnitField",
             "title":"Organization unit",
             "type":"text",
             "width":150,
             "canEdit":false,
             "canSort":false,
             "filterEditorType":"SelectItem",
             "filterEditorValueMap":
             {
              1:"*",
              2:"Warning: wrong prefix of None",
              3:""
             },
             "defaultFilterValue":1,
             "hoverHTML":"return 'Organization unit'",
             "showHover":true
            }
           ],
           "dataFormat":"json",
           "dataURL":"ScListGridTransport?viewNumber=6&id=personsListGrid",
           "transformRequest":clwTransformRequest,
           "transformResponse":clwTransformResponse,
           "recordXPath":"/resultData"
          }
          ),
         "autoFetchData":true,
         "dataPageSize":30
        }
        ),
    Datasource JSON
    Code:
    {
     "totalRows":4,
     "endRow":3,
     "startRow":0,
     "resultData":
     [
      {
       "userIdField":"Peter",
       "personelNumberField":"2134",
       "lastnameField":"McCoy",
       "firstnameField":"Peter",
       "organizationUnitField":"",
       "generatedIndex":"1"
      },
      {
       "userIdField":"George",
       "personelNumberField":"85",
       "lastnameField":"Mcintosh",
       "firstnameField":"George",
       "organizationUnitField":"",
       "generatedIndex":"2"
      },
      {
       "userIdField":"q",
       "personelNumberField":"1",
       "lastnameField":"Miller",
       "firstnameField":"John",
       "organizationUnitField":"",
       "generatedIndex":"3"
      },
      {
       "userIdField":"JohnR",
       "personelNumberField":"945",
       "lastnameField":"Rice",
       "firstnameField":"John",
       "organizationUnitField":"",
       "generatedIndex":"4"
      }
     ]
    }

    #2
    Hi Isomorphic,

    any hint for this issue?

    BTW: Is this correct, when returning 4 rows, that the first is 0, and the last is 3? Because the startRow and endRow are zero based?

    ...
    "totalRows":4,
    "endRow":3,
    "startRow":0,
    "resultData":
    ...

    Greetings Thomas

    Comment


      #3
      Correct, startRow and endRow are zero-based.

      Comment


        #4
        Thank you. Any clue for the above problem?

        Comment


          #5
          You're showing just one pair of request and response, and those are fine. The problem is somewhere else. Just look over the row numberings across all your requests and responses very carefully. The grid will only show "No items to show" if you've returned 0 for totalRows or have in some other way cleared out the data (eg grid.setData([])).

          Comment


            #6
            The problem occurs just with this one short request of 4 rows. Entering John in the first name filter leads to no filter request (correct) and to "No items to show" (wrong)

            If the result set is lager than the paging size, then entering something in the filter leads to a filter request, which answers then correct results from the server.

            So I think there must be something wrong in my above code and the data source JSON...

            Comment


              #7
              Ah - you've got a defaultFilterValue in the organizationUnitField field, but the data returned doesn't match it. So the client side filter is applying that filter value to the loaded set of records and getting no results back.

              If you set organizationUnitField:"1" on each record in the JSON response the second filter will do the right thing.

              Comment

              Working...
              X