jQWidgets Forums
jQuery UI Widgets › Forums › Scheduler › Missing Owner resources options
Tagged: resources options missing
This topic contains 2 replies, has 1 voice, and was last updated by pcesar12 8 years, 7 months ago.
-
Author
-
Hello,
After add source: adapter in jqxScheduler when my adapter is empty because not have any register in MySQL the owner option is broke, even i declare in the code the array with resources options… not show for user, but if i add manual result at MySQL and reload page when i go add new register the owner option come back work again, is some bug or wrong configuration?
resources: resources: { source: ['Sala 1', 'Sala 2', 'Sala 3', 'Sala 4', 'Sala 5', 'Sala 6'], colorScheme: 'scheme01', orientation: 'none' //horizontal //vertical },
<!DOCTYPE html> <html lang="en"> <head> <meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/> <meta name="msapplication-tap-highlight" content="no" /> <link rel="stylesheet" href="lib/jqwidgets/styles/jqx.base.css" type="text/css" /> <link rel="stylesheet" href="lib/jqwidgets/styles/jqx.windowsphone.css" type="text/css" /> <link rel="stylesheet" href="lib/jqwidgets/styles/jqx.blackberry.css" type="text/css" /> <link rel="stylesheet" href="lib/jqwidgets/styles/jqx.android.css" type="text/css" /> <link rel="stylesheet" href="lib/jqwidgets/styles/jqx.mobile.css" type="text/css" /> <script type="text/javascript" src="lib/scripts/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxcore.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxbuttons.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxscrollbar.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxdata.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxdate.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxscheduler.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxscheduler.api.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxdatetimeinput.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxmenu.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxcalendar.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxtooltip.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxwindow.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxcheckbox.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxlistbox.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxdropdownlist.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxnumberinput.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxradiobutton.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxinput.js"></script> <script type="text/javascript" src="lib/jqwidgets/globalization/globalize.js"></script> <script type="text/javascript" src="lib/jqwidgets/jqxvalidator.js"></script> <script type="text/javascript"> $(document).ready(function () { var source = { dataType: 'json', dataFields: [ { name: 'id', type: 'number' }, { name: 'resourceId', type: 'string' }, { name: 'subject', type: 'string' }, { name: 'description', type: 'string' }, { name: 'from', type: 'date', format: "yyyy-MM-dd HH:mm"}, { name: 'to', type: 'date', format: "yyyy-MM-dd HH:mm" } ], id: 'id', url: 'get_task.php' }; var adapter = new $.jqx.dataAdapter(source); $("#jqxScheduler").jqxScheduler({ width: 1200, height: 600, view: 'weekView', showLegend: true, source: adapter, resources: { source: ['Sala 1', 'Sala 2', 'Sala 3', 'Sala 4', 'Sala 5', 'Sala 6'], colorScheme: 'scheme01', orientation: 'none' //horizontal //vertical }, editDialogCreate: function (dialog, fields, editAppointment) { console.log(fields); fields.allDayContainer.hide(); fields.colorContainer.hide(); fields.repeat.hide(); fields.repeatContainer.hide(); fields.repeatEndPanelContainer.hide(); fields.repeatLabel.hide(); fields.repeatPanel.hide(); fields.timeZoneContainer.hide(); fields.locationContainer.hide(); fields.statusContainer.hide(); fields.resource.show(); fields.resourceContainer.show(); fields.resourceLabel.show(); }, views: [ {type: 'dayView', showWorkTime: false, timeRuler : {scaleStartHour : 8, scaleEndHour : 19, formatString : 'HH:mm'} }, {type: 'weekView', showWorkTime: false, timeRuler : {scaleStartHour : 8, scaleEndHour : 19, formatString : 'HH:mm'} }, {type: 'monthView', showWorkTime: false, timeRuler : {scaleStartHour : 8, scaleEndHour : 19, formatString : 'HH:mm'} } ], localization: { days: { // full day names names: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"], // abbreviated day names namesAbbr: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"] }, months: { // full month names (13 months for lunar calendards -- 13th month should be "" if not lunar) names: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro", ""], // abbreviated month names namesAbbr: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez", ""] } }, }); $('#jqxScheduler').on('appointmentAdd', function (event) { var args = event.args; var appointment = args.appointment; var data = { method:'add', id:appointment.id, resourceId:appointment.resourceId, subject:appointment.subject, description:appointment.description, from:appointment.from.toString(), to:appointment.to.toString() }; var myJSON = JSON.stringify(data); $.post( "set_task.php", myJSON, function (result) { if(result == 'true'){ console.log('Registro inserido com sucesso!'); } else{ $('#jqxScheduler').jqxScheduler('beginAppointmentsUpdate'); $('#jqxScheduler').jqxScheduler('deleteAppointment', data.id); $('#jqxScheduler').jqxScheduler('endAppointmentsUpdate'); alert('Erro na aplicação contate do administrador!'); } }); }); $('#jqxScheduler').on('appointmentChange', function (event) { var args = event.args; var appointment = args.appointment; var data = { method:'change', id:appointment.id, resourceId:appointment.resourceId, subject:appointment.subject, description:appointment.description, from:appointment.from.toString(), to:appointment.to.toString() }; var myJSON = JSON.stringify(data); $.post( "set_task.php", myJSON, function (result) { if(result == 'true'){ console.log('Registro atualizado com sucesso!'); } else{ alert('Erro na aplicação contate do administrador!'); location.reload(); } }); }); $('#jqxScheduler').on('dateChange', function (event) { var args = event.args; console.log(args); var date = args.date; var from = args.from; var to = args.to; }); }); </script> </head> <body class='default'> <div id="main" style="width:1280px;margin: 0px auto 0px auto;"> <h2>Controle de Agendamentos</h2> <div id="jqxScheduler"></div> </div> </body> </html>
I found the error, when my mysql is empty i only return nothing, but the javascript need minimal json,
solution:
if(isset($array)) echo json_encode($array); else echo json_encode(array());
php return [] when mysql is empty and work fine the owner options.
thanks
best regards
Cesar Corsico -
AuthorPosts
You must be logged in to reply to this topic.