jQuery UI Widgets Forums Angular Display problem with jqxScheduler and 2 tables for appointments and resources

This topic contains 1 reply, has 2 voices, and was last updated by  Todor 4 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • alain_bnp
    Participant

    To fill a jqxScheduler, I have 2 tables, one for appointments, one for resources, linked by a foreign key. Their data come from a database.

    
    appointment: {
      id: number,
      title: string,
      resource_id: number; // Foreign key to the table resources, id field
    }
    
    resource: {
      id: number,
      title: string
    }
    

    In both case, I use jqx.dataAdapteur to give data to the jqxScheduler / Timelines with resources (vertical).
    The problem is that I cannot display appointments in resources with the following configuration:

    
    public resourceSource: any = {
          datatype: 'array',
          datafields: [
              { name: 'id', type: 'number' },
              { name: 'title', type: 'string' },
              { name: 'resource_id', type: 'number', map: 'id' }
          ],
          id: 'resource_id',
          localdata: array of resources coming from database
      };
    
    public resources: any = {
          colorScheme: 'scheme04',
          dataField: 'resource_id',
          orientation: 'vertical',
          source: new jqx.dataAdapter(resourceSource)
      };
    
    public appointmentSource: any = {
        datatype: 'array',
        datafields: [
            { name: 'id', type: 'number' },
            { name: 'resource_id', type: 'number' },
            { name: 'title', type: 'string' },
            { name: 'starting_date', type: 'date' },
            { name: 'ending_date', type: 'date' }
        ],
        id: 'id',
        localdata: array of appointments coming from database
      };
    
    public appointmentDataFields: any = {
          from: 'starting_date',
          to: 'ending_date',
          id: 'id',
          description: 'title',
          location: '',
          subject: 'title',
          resourceId: 'resource_id'
      };
    
    

    Initially displayed, the resources display/become ‘undefined’ when the appointment are added to jqxScheduler, and the appointments are not displayed at all.
    If I don’t put any resources, appointments are displayed correctly.

    Any idea?


    Todor
    Participant

    Hello alain_bnp,

    I’m not quite sure what you are trying to achieve with the second table for the resources. The resources’ source should point to appointmentSource:

    public resources: any = {
      colorScheme: 'scheme04',
      dataField: 'resource_id',
      orientation: 'vertical',
      source: new jqx.dataAdapter(appointmentSource)
    };

    Resources are an addition to the appointments.

    Let us know if you need further assistance.

    Best Regards,
    Todor

    jQWidgets Team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.