Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/02/2012, 10:49
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 14 años, 4 meses
Puntos: 6
Problema al recargar div

hola amigos del foro espero me puedan ayudar

tengo el siguiente codigo con el cual inserto,consulto y elimino un evento , trabajo con fullcalendar

el inconveniente es :

si inserto mas de un evento el programa lo hace sin problemas , pero si en ese momento necesito eliminar uno de los eventos insertados en ese momento ya que elimina todos los eventos insertados, funciona bien si recargo bien la pagina .


Código Javascript:
Ver original
  1. <script type='text/javascript'>
  2.  
  3.         $(document).ready(function() {
  4.    
  5.         var date = new Date();
  6.         var d = date.getDate();
  7.         var m = date.getMonth();
  8.         var y = date.getFullYear();
  9.        
  10.         var calendar = $('#calendar').fullCalendar({
  11.        
  12.         theme: true,
  13.             header: {
  14.                 left: 'prev,next today',
  15.                 center: 'title',
  16.                 right: 'month,agendaWeek,agendaDay'
  17.             },
  18.             selectable: true,
  19.             selectHelper: true,
  20.             select: function(start, end, allDay) {
  21.                 var title = prompt('Evento:');
  22.                 if (title) {
  23.                     $.ajax({
  24.                          url:'archivo.php',
  25.                          type:'post',
  26.                          data:{
  27.                             title: title,
  28.                             start: start.toUTCString(),
  29.                             end: end.toUTCString(),
  30.                             allDay: allDay,
  31.                          }
  32.                     }).done(function(data) {
  33.                             alert("Evento Guardado");
  34.                          //alert("Datos guardados, respuesta: " + start);
  35.                     });
  36.                     calendar.fullCalendar('renderEvent',
  37.                         {
  38.                            
  39.                             title: title,
  40.                             start: start,
  41.                             end: end,
  42.                             allDay: allDay,
  43.                        
  44.                            
  45.                         },
  46.                         true // make the event "stick"/ make the event "stick"
  47.                        
  48.                     );
  49.                 }
  50.                 calendar.fullCalendar('unselect');
  51.             },
  52.             editable: false,
  53.            
  54.    
  55.        
  56.     eventClick:function filter(event) {
  57.            if (!confirm("Realmente desea eliminar este evento")) {
  58.                         revertFunc();
  59.                    }
  60.                    else {
  61.         $('#calendar').fullCalendar('removeEvents',event.id)
  62.        
  63.                        $.ajax({
  64.                          url:'eliminar.php',
  65.                          type:'post',
  66.                          data:{
  67.                             id:event.id,
  68.                                                      }
  69.                     }).done(function(data) {
  70.                          alert("Evento Eliminado");
  71.                     });
  72.        
  73.           }
  74.          },
  75.        
  76.        
  77.                      
  78.             eventMouseover: function(calEvent, jsEvent, view) {
  79.                                 savBg = $(this).css("background-color");
  80.                                 savClr = $(this).css("color");
  81.                                 $(this).css( { color:'#ffff00', backgroundColor:"#006" } );
  82.                                 $("#test").css( { color:'#ffff00', backgroundColor:"#006" } );
  83.                                 $(this).fadeTo('slow',.5);//.css(text-align,'right');
  84.                         },
  85.                     eventMouseout: function(calEvent, jsEvent, view) {
  86.                                 $(this).css( { color:savClr, backgroundColor:savBg } );
  87.                                 $("#test").css( { color:savClr, backgroundColor:savBg } );
  88.                                 $(this).fadeTo('slow',1);
  89.                         },
  90.  
  91.            
  92.  
  93.            
  94.             events: "eventos.php",
  95.                
  96.         eventRender: function (event, element) {
  97.         element.qtip({    
  98.             content: {    
  99.                 title: { text: event.title },
  100.                
  101.                 text:'<span class="title">Id:</span>'+ event.id+'<br><span class="title">Inicio: </span>' + ($.fullCalendar.formatDate(event.start, 'hh:mmtt')) + '<br><span class="title">Fin: </span>' + ($.fullCalendar.formatDate(event.end, 'hh:mmtt'))      
  102.             },
  103.            
  104.             show: { solo: true },
  105.             //hide: { when: 'inactive', delay: 3000 },
  106.             style: {
  107.                 width: 200,
  108.                 padding: 5,
  109.                 color: 'black',
  110.                 textAlign: 'left',
  111.                 border: {
  112.                 width: 1,
  113.                 radius: 3
  114.              },
  115.                 tip: 'topLeft',
  116.  
  117.                 classes: {
  118.                     tooltip: 'ui-widget',
  119.                     tip: 'ui-widget',
  120.                     title: 'ui-widget-header',
  121.                     content: 'ui-widget-content'
  122.                 }
  123.             }
  124.         });
  125.     }
  126.            
  127.         });
  128.        
  129.     });
  130.    
  131.    
  132.  
  133. </script>

Código HTML:
Ver original
  1. <div id='loading' style='display:none'>loading...</div>
  2. <div id='calendar'></div>
  3. </body>