21_multiselect_options sample usage

hi stanislav,

i am newbie on dhtmlxschedular…
i am using 21_multiselect_options sample in which i am saving users ids in event_user table
but i need to open read only form if event is belong to that user but m confuse hoe to fetch user_id from event_user table which contain event id and user id only and else info of event is in event_ms table
can u please tell me how can i retrieve user-id of a particular event becoz user id is in another table

hi dhtmlx team ,

I am waiting for your reply guys please reply ASAP

Check server side code in events_multiselect_static.php it uses similar linking to the event_user table ( you can ignore code which uses fruit, event_fruit, fruit_id )

With such server side code, scheduler will have info about all users on client side

scheduler.getEvent(id).user_id - will produce list of user id’s to which event belongs.

Thank you so much sir for replying me…successfully implement it thanks to you

one more thing i want to know which is i m using this code to filter events in which $arr is an array of username according to which events filtered on click of checkbox its working fine i use event_user table for this

scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = scheduler.filter_workweek= scheduler.filter_decade = function(ev_id, event){
if(event.user_id=="<?=$arr[0];?>")
return true;
if(event.user_id=="<?=$arr[1];?>")
return true;
if(event.user_id=="<?=$arr[2];?>")
return true;
if(event.user_id=="<?=$arr[3];?>")
return true;
if(event.user_id=="<?=$arr[4];?>")
return true;
return false;
}
but now i want to implement one more filter for user convenience to filter already filtered tasks (which is already filtered by username) i want second filter filter of task category
user after filter events according to username can also filter events according to event category
events detail are in event_ms table and they contain category field also
now how can i add this functionality ? is two filter works ?please suggest me sir waiting for your reply

API allows to assign only one filtering method, but it may call sub-routines inside, so you will be able to use as much logic rules as necessary.

scheduler.filter_day = scheduler.filter_week = scheduler.filter_month = scheduler.filter_workweek= scheduler.filter_decade = function(ev_id, event){ if(event.user_id=="<?=$arr[0];?>") return check_category(event); if(event.user_id=="<?=$arr[1];?>") return check_category(event); if(event.user_id=="<?=$arr[2];?>") return check_category(event); if(event.user_id=="<?=$arr[3];?>") return check_category(event); if(event.user_id=="<?=$arr[4];?>") return check_category(event); return false; } function check_category(event){ if (event.category_id == SOME) return true; return false; }

hi stanislav,

thanx i have successfully implement this feature all credit goes to you.

one more thing

while reading forum to enchance my project more i was oes through this article viewtopic.php?f=6&t=24500

You gave this solution in above article:-------
Be sure that your sql code returns them with different ids ( or remove id field from render command of connector, to generate unique IDs for all events )
If scheduler gets two records with the same ID, only one will be rendered.

Also, you can load events normally without duplication, but on client side, assign custom code to onEventLoading event, it will be called for each new record in incoming xml - so you will be able to add “fictive” events with different colors from such handler.

i tried this but little bit confuse
if i try your first solution same events with different colors display but when i am going to update that event it cant be updated …why???/

and the second one solution <!----Also, you can load events normally without duplication, but on client side, assign custom code to onEventLoading event, it will be called for each new record in incoming xml - so you will be able to add “fictive” events with different colors from such handler.
---->
i couldn’t not understand exactly how to do how an xml file have all events od database can u plz ellaborate that how can i use this and implement it exactly???

but when i am going to update that event it cant be update
Kind of expected - in first case client side doesn’t know real IDs of events (they are fictive or auto-generated ), so it can’t save data back to database.

i couldn’t not understand exactly how to do how an xml file have all events od database can u plz ellaborate that how can i use this and implement it exactly

It still will cause issues for data saving, because it will create a fictive events as well, the only difference that it will create them on client side, not on server side.

Basically to save data - you need to have a related record in database ( one-to-one relation ) , any solution which produces multiple visible events from the single record will not allow data saving ( unless, you will create a custom saving logic )

If you still interested I can provide a sample|snippet for client side “event copy adding”.

yes , plese give me that code snippet i must want to try this
and tell me by using that can i able to add or
update data by using custom logic ???

and one more thing i thought bt dnt know it is possible or not or how

can i define a css for multi user event means if an event has more tan one user then it has a
fixed color which is defined in css for multi user bt the issue is how
hw to count userid for a single event or if an event has only one user
then normal event colors

is it possible or it is bad logic of mine

scheduler.templates.event_class = function(s,e,ev){ if (ev.users.indexOf(",") != -1) //assuming that users is a comma separated list of user-ids return "multipleusers"; //custom css return ""; // default css }

scheduler.attachEvent("onEventLoading", function(ev){
    if (ev.users.indexOf(",") != -1){
          var ids  = ev.users.split(",");
          for (var i=0; i<ids.length; i++)
               var new_event = scheduler._copy_event(evs[i]); //copy master event
               new_event.user_id = ids[i]; //assign id of related user
               new_event.id =  new_event.id + "_" + ids[i];
               scheduler.addEvent(evs[i]); //add to the scheduler
               return false;
     }
     return true;
}

above code will create multiple visible events for the single record in a database

hi stanislav,

thanx for the snippets
1.) scheduler.templates.event_class = function(s,e,ev){
if (ev.users.indexOf(“,”) != -1) //assuming that users is a comma separated list of user-ids
return “multipleusers”; //custom css
return “”; // default css
}

2.)scheduler.attachEvent(“onEventLoading”, function(ev){
if (ev.users.indexOf(“,”) != -1){
var ids = ev.users.split(“,”);
for (var i=0; i<ids.length; i++)
var new_event = scheduler.copy_event(evs[i]); //copy master event
new_event.user_id = ids[i]; //assign id of related user
new_event.id = new_event.id + "
" + ids[i];
scheduler.addEvent(evs[i]); //add to the scheduler
return false;
}
return true;
}
in both code you split the user ids with comma after that other process run but i am not saving multiple user id with comma in table. the event_user table screenshot are given below.
how can i use these codes for this
sry i am new in programming…

If you are using crossoptionsconnecto
docs.dhtmlx.com/doku.php?id=dhtm … ultiselect

It will provide list of linked records as comma separated list
check
samples/03_extensions/data/events_multiselect_static.php

is this code snippet will work with connector or not???

hi stanislav,
is the code snippet you gave will work with connector or not???

Yep, client side doesn’t depend on server side implementation, so it can work with connector or with custom server side code.

The above link shows the usage of cross-table connectors, which can fetch list of user ids in the necessary way ( as comma separated string ), but you can replace it with custom code if you wish - there is no strict dependency

hi stanislav,

i tried your code but it doesn’t work may b the problem is from my side …i am sending you the whole code can you please do me a favor please tell me i am going in right direction or not…you code is on line number 101

 
 
 
		<div class="dhx_cal_tab" name="week_tab" style="right:300px;"></div>

		<div class="dhx_cal_tab" name="workweek_tab" style="right:90px;"></div>

		<div class="dhx_cal_tab" name="decade_tab" style="right:160px; "></div>

		<div class="dhx_cal_tab" name="month_tab" style="right:370px;"></div>

				<div class="dhx_cal_tab" name="agenda_tab" style="right:20px;"></div>
	
	<div class="dhx_cal_header">
	</div>
	<div class="dhx_cal_data">
	</div>

hi stainslav,

i am still waiting for your reply please help me

hi stanislav,
sorry if i bother you bt please reply me i am waiting for you suggestions

hi stanislav,
till nw i didn’t get any reply from you …please reply me

hi dhtmlx team,

please reply me …i am waiting for your suggestion

Hi dhtmlx team,
Please can you tell me the solution