Menu
Welcome, Guest
Username: Password: Secret Key Remember me
Welcome to the Developer forum!
Get all your questions answered here. Learn to integrate calendar in your application.
  • Page:
  • 1

TOPIC: Values of Group combobox to be populated with the different table

Values of Group combobox to be populated with the different table 14 years 2 months ago #339

  • shirish
  • shirish's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 12
  • Thank you received: 0
Hi,


I want to populate the group dropdown with the values from different mysql table ,so i am stuck with the code as in how to implement,i have implemented the form by referring the customtemplate.html file using the following code for populating data:i am not getting from where these parameters are passed to this function (obj, groups, allday),as in while loading the calendar we just mention the events to be called.also how the group dropdown gets the data from mysql table,n how we change it to get the data from different mysql table


function onNewEvent(obj, groups, allday)
{
var st = new UTC(obj.startTime);
var ed = new UTC(obj.endTime);
var newevt=jQuery(\"#customNewEventTemplate\");
//Clear out and reset form
newevt.find(\"#eventDesc\").val(\"\").end()
.find(\"#eventName\").val(\"\").focus().end()
.find(\"#eventStartDate\").val( st.toStandardFormat()).end()
.find(\"#eventEndDate\").val(ed.toStandardFormat() ).end();

if(allday)
newevt.find(\"#allDayEvent\").attr(\"checked\", true).end()
.find(\"#eventStartTime\").val(\"\").end()
.find(\"#eventEndTime\").val(\"\");
else
newevt.find(\"#allDayEvent\").attr(\"checked\", false).end()
.find(\"#eventStartTime\").val( st.toNiceTime() ).end()
.find(\"#eventEndTime\").val( ed.toNiceTime() );

//display a list of groups to select from.
var groupDD=newevt.find(\"#eventGroup\").get(0);
removeAllOptions(groupDD);
for(var g in groups)
{
if(!groups.hasOwnProperty(g))continue;
var gId = groups[g].groupId;
addOption(groupDD, groups[g].groupName,groups[g].groupId,false);
}
if(obj.group && obj.group.groupId)
newevt.find(\"#eventGroup\").val(obj.group.groupId);

newevt.find(\"#newEvAddEventBtn\").show().end()
.find(\"#newEvUpdateEventBtn\").hide();
}


Does anyone have any idea regarding this.Pls help

Thanks in advance

Please Log in to join the conversation.

Re: Values of Group combobox to be populated with the different table 14 years 2 months ago #340

  • alammm
  • alammm's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 11
  • Thank you received: 0
Shirish, I don\'t understand your question.

Do you want to populate the Groups Drop down with your own values?

If yes, then it should be simple to update the drop down with your own values with the above method.

If your question is how onNewEvent is invoked, it is a callback method invoked by Calendar.

Hope this answers your question. If not, explain more.

Please Log in to join the conversation.

Re: Values of Group combobox to be populated with the different table 14 years 2 months ago #341

  • shirish
  • shirish's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 12
  • Thank you received: 0
Thanks alammm.but still i am not clear,

My question is that i am using a different fields in mysql table say for eg:- I am haiving Bookings table(mysql) and i am having the dropdown of hotel rooms to be booked which is to be populated from rooms column in bookings table..so how do i populate it in the dropdown.


what i have understood is this chunk of code populates the data in group dropdown in customtemplate.html


//display a list of groups to select from.
var groupDD=newevt.find(\"#eventGroup\").get(0);
removeAllOptions(groupDD);
for(var g in groups)
{
if(!groups.hasOwnProperty(g))continue;
var gId = groups[g].groupId;
addOption(groupDD, groups[g].groupName,groups[g].groupId,false);
}
if(obj.group && obj.group.groupId)
newevt.find(\"#eventGroup\").val(obj.group.groupId);

newevt.find(\"#newEvAddEventBtn\").show().end()
.find(\"#newEvUpdateEventBtn\").hide();
}

But where is the data retrieved from database...there has to be query to the mysql table to populate in dropdown....i hope you got my question else i would explain it more

Thanks in advance

Please Log in to join the conversation.

Re: Values of Group combobox to be populated with the different table 14 years 2 months ago #342

  • alammm
  • alammm's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 11
  • Thank you received: 0
Ok this is very simple. There are a couple of ways to do this. What I understand is you need a set of records for loading into a drop down. You don\'t want to use the Groups List provided as a param to callback method.

1. This drop down can be loaded as any other drop down in a normal page. (On Load retrieve list, loop and create the drop down).
2. in onNewEvent you can make an Ajax Call to get the records.

Let me know if this is clear now.

Please Log in to join the conversation.

Re: Values of Group combobox to be populated with the different table 14 years 2 months ago #343

  • shirish
  • shirish's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 12
  • Thank you received: 0
Thanks....the issue got solved...

Please Log in to join the conversation.

Last edit: by shirish.

Re: Values of Group combobox to be populated with the different table 14 years 2 months ago #344

  • shirish
  • shirish's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 12
  • Thank you received: 0
In customtemplates.html,inside function editMyEvent(eventId) there is function call getEventById(eventId); i wanted to know where is this js function defined can\'t able to recollect.

Please Log in to join the conversation.

  • Page:
  • 1
Time to create page: 0.106 seconds
Powered by Kunena Forum

LATEST IN FORUM

  • No posts to display.

ABOUT US