Hello everyone!
This is my first post here, I am still in the learning phase, so have patience with me.
Here, i’m trying customize the text box for view day, I’m Loading into the blue box several records, but i have one especific column (from sql), called “event_motivo” that only points to another table.
My main SQL table is:
CREATE TABLE IF NOT EXISTS `records` (
`event_id` int(11) NOT NULL AUTO_INCREMENT,
`event_start` datetime NOT NULL,
`event_end` datetime NOT NULL,
`event_text` text NOT NULL,
`event_cliente` text NOT NULL,
`event_cod_cliente` text NOT NULL,
`event_fone` text NOT NULL,
`event_motivo` text NOT NULL,
PRIMARY KEY (`event_id`)
);
Saying about the work already done:
scheduler.load("exec/data.php");
var dp = new dataProcessor("exec/data.php");
dp.init(scheduler);
data.php:
[code]$list = new OptionsConnector($res, $dbtype);
$list->render_table(“motivo”,“motivo_id”,“motivo_id(value),motivo_motivo(label)”);
$scheduler = new schedulerConnector($res, $dbtype);
$scheduler->set_options("event_motivo", $list);
$scheduler->render_table("records","event_id","event_start,event_end,event_text,event_motivo,event_fone,event_cod_cliente,event_cliente");[/code]
Custom box code:
[code]scheduler.templates.event_text=function(start,end,event){
return “Client Name: " + event.event_client +
" | Evento: “+ event.event_motivo +””;
… }[/code]
Here the preview print:
Note that it brings the numerical value correctly. But as i said, i need mapping for the 2nd table:
View:
2nd SQL TABLE:
CREATE TABLE IF NOT EXISTS `motivo` (
`motivo_id` int(11) NOT NULL AUTO_INCREMENT,
`motivo_motivo` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`motivo_id`)
);
INSERT INTO `motivo` (`motivo_id`, `motivo_motivo`) VALUES
(1, 'Vestido de Venda');
And, the print of 2nd table:
So what i can do to show for view day, those values mapping from 2nd sql table?
Example of sucess:
I’ve tried (without success) running one ajax call (jquery) like:
function loadTextFrom2ndTable($value){
var request = $.ajax({
url: "exec/load.php",
type: "GET",
data: {'motivo' : $value }, //motivo
dataType: "html"
});
request.done(function( msg ) {
return msg;
});
}
And into html code, i’ve tried (without success) :
scheduler.templates.event_text=function(start,end,event){ .....
....
return ".... " + loadTextFrom2ndTable(event.event_motivo) ".... ";
But din’t work, i got some error message into blue box–> undefined
I’ve made some searchs, and found some like:
scheduler.parse(data, "json");
scheduler.updateView();
But i dont have any idea, anyone could help me?
Thanks