database key issue -database updating but scheduler view not

Hello -
I’ve solved some of the original issues with respect to this topic and therefore decided to start a new thread.
When I create an event, it gets properly updated in the database. Howver, if I then delete or modify this same event (via lightbox), it displays properly with the new changes in scheduler, however it does not get updated in the database.
After a little hair pulling, I had look at the identity field (main key for the database) during this process (I mapped the id into a lightbox field) and the following happens -
When I create a new event, the lightbox opens up and shows the id field and associated number which is automatically generated. I then do a save in the lightbox and the database itself gets updated with the proper number. If I then open the same event, there is a totally different number in the id field. So that explains the inability to delete or modify the event in the database.
If I do a manual refresh of the browser, then the proper number gets loaded into scheduler and I can then modify, etc.

Any help would be appreciated!

Are you using dataprocessor for data saving, or custom code?
Dataprocessor will change id to new one automatically, in case of custom code you need to do it manually ( schedule has related API )

If you are using datprocessor and it still doesn’t work

a) please try to use firebug like tool, and check response of server for data saving call - it must be a valid xml with tid=“new id” attribute. It quite possible that some custom code on server side breaks xml forming and as result it doesn’t recognized correctly on client side.

b) if response contains something like tid=“0x234243343” - check the connector configuration, most probably the ID field ( second parameter of render_ command ) is invalid or not specified.

Thanks for the reply -
Just to clarify - when I create the event in scheduler, I look at the id value created by scheduler in my lightbox and after saving, see that it gets sent to the database properly. If I then re-open that event in scheduler, I see that the id is not the same anymore. Here`s the snippet of code for the client side (maybe something will jump out at you that is obvious) -

scheduler.attachEvent("onEmptyClick", function(id, e) {
	var action_data = scheduler.getActionData(e);
	  var event = {
		end_date:, 6.5, "hour"),
                    teacher_id: action_data.section,
                    user_id: sID,
                    company_id: sCompanyID
});  // end of attachEvent on Emptyclick

	scheduler.init('scheduler_here',new Date(),"month");

	scheduler.load("/path/connector.php"); // end of sheduler.load

   var dp = new dataProcessor("/path/connector.php");

connector.php snippet -

$scheduler->render_sql("Select from database where company_id = 2","id","start_date,end_date,id,teacher_id,user_id,company_id,created_at,updated_at");

I’ll try and dig further on my side. If the above provides you with a clue to what the issue might be …
Thanks in advance,

I’m a bit of a newb on all this, but managed to run firebug and get the server response -

<?xml version='1.0' ?>

I had made a mistake when I said that the database had the correct id in it. In fact the id associated with the above database record is id=‘1354720003647’. Pardon me, I didn’t take a close enough look at the lower digits.
So to re-cap - I create an event and when the lightbox gets pulled up, tid number is generated. Then after a save, the database had the id number in it and scheduler has the sid number (id, sid, tid corresponds to above numbers.

All that to say, it looks like it may be the issue you mentioned. I’ve forwarded the code snippets earlier in this thread. The id field is present and accounted for. Suggestions?

Thanks in advance,

Above code looks fine

 If I then re-open that event in scheduler, I see that the id is not the same anymore

Normally process goes like next

  • new event added, random id assigned
  • data sent to server side
  • db assigns unique id
  • id returned back to client
  • random id changed to the one, assinged by DB

You need not any custom code for above process, it is done automatically by dataprocessor-connector libs.

I had made a mistake when I said that the database had the correct id in it. In fact the id associated with the above database record is id=‘1354720003647’.

I suspect that table do not have autoincrement flag for the id field, as result it uses random ids from client side, which truncated because of id field size. To fix this issue - add autoincrement flag to id field.

The autoincrement is set for the id flag, so that’s not the issue. Any other ideas?

Hi Stanislav -
I went back to some older files that I first generated in order to get acquainted with Scheduler. I figured I might be able to re-create the problem. So I have some standard server side code based on the following -

The above works no problem in that the issue that I’ve been having is not there.
If I add the id field to the list of fields above like so -

it will exhibit the problem that I outlined. Interestingly enough, if I go back to the render_table without the id in the field list, the problem will still be there. The only way to get it working properly again is to clear and re-load the database AND use the non id in the field list version. If the id field is not in the field list, the problem never happens.

So back to the new implementation -
$scheduler->render_sql(“Select from database where company_id = 2”,“id”,“start_date,end_date,id,teacher_id,user_id,company_id,created_at,updated_at”);

I figured that all I have to do is remove the id field from the field list in the version that I’m trying to get to work and all should be fine. However, getting rid of the id from the field list results in not being able to connect to the database and results in other problems.
The main difference between the older version is the description field. So I created a dummy description field in my database and tried -
$scheduler->render_sql(“Select from database where company_id = 2”,“id”,“start_date,end_date,description,teacher_id,user_id,company_id,created_at,updated_at”);

Now it works. Is there a way to do this so that I don’t have to include a dummy field in my database?

BTW - after searching through the forum, I’ve found a number of posts that outline a similar problem. I hope that this will help others.