CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Detail form

by etwoss » 06 Feb 2014 09:02

Hi

I'm all new to CGDevTools. I don't see a Schedular topic so i think JQPlanner is the schedular from the demo.
In the demo i see that two custom fields are added.

What are the possibilities here?

I need to be able to add at least 7 fieldsm which will be dropdown's also, is this possible?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 06 Feb 2014 11:14

Hello

As you can see if the SchedulerDemo (also included in jQueryDemo_V2), we have a custom frame to be able to edit the two custom fields: customfield1 and customfield2. These are part of a json object - AEventItem.UserData that can store any json structure you like.

The event OnEventToSchedulerFrameControls (= SchedulerEventToSchedulerFrameControls handler in the demo), is called when the editor is going to be displayed to the user, for a new or existing event.

In the event handler, we will fill the controls with the user data, and we can also initialize the custom fields.

Code: Select all
  UserDataObj:= SO(AEventItem.UserData);
  if Assigned(UserDataObj) then
  begin
    if UserDataObj.DataType = stNull then // new event
    begin
       UserDataObj.S['customfield1']:= 'Default data';
    end;
    MyFrame.edCustomField1.Text:= UserDataObj.S['customfield1'];
    MyFrame.edCustomField2.Text:= UserDataObj.S['customfield2'];
  end;


UserDataObj is a json object, you can add any fields and field types you like, including nested objects, for instance:

Code: Select all
  UserDataObj.I['customintegerfield']:= 1234;
  UserDataObj.B['custombooleanfield']:=True;

  NestedObject:= SO();
  NestedObject.S['someprop']:= 'somevalue';

  UserDataObj.O['customobjfield'']:= NestedObject;


Then in the event OnSchedulerFrameControlsToEvent (= SchedulerSchedulerFrameControlsToEvent handler in the demo)

that is called when the event is created (or edited) we assign the custom fields, using the code

Code: Select all
  UserDataObj:= SO();
  UserDataObj.S['customfield1']:= MyFrame.edCustomField1.Text;
  UserDataObj.S['customfield2']:= MyFrame.edCustomField2.Text;
  AEventItem.UserData:= UserDataObj.AsJSon;
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQScheduler

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.