Announcement

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

    Calendar DataBound Pagination

    Does the Calendar widget support date based pagination natively?

    I saw this forum post: https://forums.smartclient.com/forum...and-pagination I just wanted to double check that this was still the case before starting making changes to use the DateChangedEvent.

    #2
    hi aderosso,

    Current Calendar code will request all data for the visible date-range, and request new data when the visible date range changes, but doesn't perform row-range pagination on scroll, for example, in the same way as ListGrids.

    Comment


      #3
      Is there something else I would need to do other than this:

      Code:
              final Calendar calendar = new Calendar();
              calendar.setDataSource(DSConst.CalendarEventSQL.DATASOURCE);
              calendar.setAutoFetchData(true);
              calendar.setStartDateField(DSConst.CalendarEventSQL.START_DATE);
              calendar.setEndDateField(DSConst.CalendarEventSQL.END_DATE);
              final AdvancedCriteria criteria = new AdvancedCriteria(OperatorId.OR,
                      new Criterion[] { new Criterion(DSConst.CalendarEventSQL.OWNER_ID, OperatorId.EQUALS, 1L),
                              new Criterion(DSConst.CalendarEventSQL.CREATOR_ID, OperatorId.EQUALS, 1L) });
              calendar.setImplicitCriteria(criteria);
              calendar.draw();
      I'm setting the start and end fields, but it's still just fetching based on the criteria and rows 0-75.

      Comment


        #4
        We're not sure what you mean by "based on the criteria".

        As explained above, the expectation is that the Calendar fetches the data based on the visible date range, but does not use row-number-based pagination: all calendar entries for the visible date range will be fetched.

        So you would expect to see some date-related criteria automatically generated and sent for you. Please tell us whether you are seeing that.

        If you are not, you should:

        1) see whether you actually have the start and end date fields declared correctly, and as type="datetime" fields (e.g. this would not be expected to work if those fields were not declared, declared to be the wrong type (eg "integer") or were not visible to the current user)

        2) try removing your use of implictCriteria. You're hoping to use inherited functionality here, we'll have to check whether it's actually supported in this case. If you find it's creating a problem, there are many other ways to introduce those criteria into the request, such as DataSource.transformRequest(). Here, it looks like the criteria involved may actually be needed for security reasons, in which case you should be introducing those criteria on the server side (e.g. in DMI logic) and not in client-side code.

        Comment


          #5
          I removed the criteria completely. Now it's just this:

          Code:
          final Calendar calendar = new Calendar();
          calendar.setDataSource(DSConst.CalendarEventSQL.DATASOURCE);
          calendar.setAutoFetchData(true);
          calendar.setStartDateField(DSConst.CalendarEventSQL.START_DATE);
          calendar.setEndDateField(DSConst.CalendarEventSQL.END_DATE);
          calendar.draw();
          The fields are defined as:

          Code:
          <DataSource ID="CalendarEventSQL"
                      serverType="sql"
                      tableName="calendar_event">
              <fields>
                  <field name="calendar_event_id" type="sequence" primaryKey="true" hidden="true"/>
                  <field name="name" type="text" required="true" length="40"/>
                  <field name="description" type="text" length="100"/>
                  <field name="notes" type="text" length="100"/>
                  <field name="creator_id" type="integer" hidden="true" foreignKey="UserSQL.userId"/>
                  <field name="owner_id" type="integer" hidden="true" foreignKey="UserSQL.userId"/>
                  <field name="project_id" type="integer" foreignKey="ProjectSQL.projectId" hidden="true" joinType="outer"/>
                  <field name="start_date" type="datetime" required="true"/>
                  <field name="end_date" type="datetime" required="true"/>
                  <field name="status_id" type="integer" foreignKey="CodeSQL.code_id" hidden="true" joinType="outer"/>
                  <field name="statusValue" type="text" canEdit="false" includeFrom="CodeSQL.code" includeVia="status_id"/>
                  <field name="created_by" type="creator"/>
                  <field name="created_time" type="creatorTimestamp"/>
                  <field name="modified_by" type="modifier"/>
                  <field name="modified_time" type="modifierTimestamp"/>
                  <field name="canEdit" type="boolean" hidden="true" customSQL="true"/>
              </fields>
          </DataSource>

          The request in this case is still just fetching rows 0-75:

          Code:
          {
              dataSource:"CalendarEventSQL",
              operationType:"fetch",
              componentId:"isc_Calendar_0",
              data:{
              },
              startRow:0,
              endRow:75,
              textMatchStyle:"exact",
              resultSet:[ResultSet ID:isc_ResultSet_0 (dataSource: CalendarEventSQL, created by: isc_Calendar_0)],
              callback:{
                  caller:[ResultSet ID:isc_ResultSet_0 (dataSource: CalendarEventSQL, created by: isc_Calendar_0)],
                  methodName:"fetchRemoteDataReply"
              },
              willHandleError:true,
              showPrompt:true,
              prompt:"Finding Records that match your criteria...",
              oldValues:{
              },
              requestId:"CalendarEventSQL$6270",
              internalClientContext:{
                  requestIndex:1
              },
              fallbackToEval:false,
              bypassCache:true,
              dataProtocol:"getParams"
          }

          Comment


            #6
            Hi Isomorphic,

            I can see the same behaviour with a 0-75 paginated fetch in this unchanged sample (v13.0p_2024-02-21, FF 122, Win10).

            Best regards
            Blama

            Comment


              #7
              Apologies for the delay in responding here - you're both correct, date-range criteria is not being included by default, except in Timelines.

              We're looking into it and will update here as soon as we have it fixed.

              Comment

              Working...
              X