When I delete an event it should refresh page

When I’m deleting an event how do I make it disappear without manually refreshing the browser?

Do I need to set a filter too? Should I use the set_response_attribute withing codeigniter and do something in my main scheduler.php.tpl?

-D

  1. main query with codeigniter works well

    //returns an array with data
    function get($request){
    $user = sess_get(‘user’);
    extract($user); // user_id, divs_selected, private

     $divs_selected = sess_get('setup','divs_selected');
    
     $sql = "select e.*,case when e.canceled = 1 then 'canceled' else 'active' end as status,s.im
    

port_source_name from events e,import_sources s where e.import_source_id = s.import_source_id and ";

    if ($is_private)
        $sql .= " ( is_private = 0 or ( is_private = 1 and user_id = '$user_id' ) ) ";
    else
        $sql .= " is_private = 0 ";

    $sql .= " and deleted is null ";

    $query = $this->db->query( $sql );

    return $query->result_array();
}
  1. delete function in codeigniter works well

function delete($action){
$event_id = $action->get_id();
$this->db->update(“events”, array(‘deleted’ => 1), array(“event_id” => $event_id));
$this->log($action, ‘delete’, $event_id);
$action->success();
}

Hello,

This should happening by default. If deleted event not dissapears, that usually means that server-side returns invalid xml or ‘error’ response.
Could you paste an example of your server response?

This is what I’m getting

Thanks,

David

david-vrb2.data-server.us/schedu … iting=true

<?xml version='1.0' ?>

TypeError: f is undefined

david-vrb2.data-server.us/dhtmlx … curring.js
Line 23

this._rec_temp=[];for(var c=this.get_visible_events_rec(a),f=[],b=0;b<c.length;b++)c[b].rec_type?c[b].rec_pattern!=“none”&&this.repeat_date(c[b],f):f.push(c[b]);return f};(function(){var a=c.isOneDayEvent;c.isOneDayEvent=function(b){return b.rec_type?!0:a.call(this,b)};var b=c.updateEvent;c.updateEvent=function(a){var f=c.getEvent(a);if(f.rec_type)f.rec_pattern=(f.rec_type||"").split("#")[0];f&&f.rec_type&&a.toString().indexOf("#")===-1?c.update_view():b.call(this,a)}})();c.transponse_size={day:1,

Here’s the post

-D

14818_cancel_reason
14818_canceled 0
14818_case_num
14818_color
14818_deleted
14818_details
14818_dhx_editor_status deleted
14818_division AA
14818_email_addr
14818_end_date 2014-01-28 14:50
14818_event_length 0
14818_event_pid 0
14818_event_type other
14818_id 14818
14818_import_source_name No import
14818_is_private 0
14818_media_type
14818_rec_type
14818_start_date 2014-01-28 12:20
14818_status active
14818_text New event type
14818_user_id dgriffis
ids 14818
Source
14818_id=14818&14818_start_date=2014-01-28%2012%3A20&14818_end_date=2014-01-28%2014%3A50&14818_text=New%20event%20type&14818_details=&14818_division=AA&14818_color=&14818_event_type=other&14818_media_type=&14818_is_private=0&14818_user_id=dgriffis&14818_rec_type=&14818_event_pid=0&14818_event_length=0&14818_canceled=0&14818_status=active&14818_cancel_reason=&14818_import_source_name=No%20import&14818_case_num=&14818_email_addr=&14818_deleted=&14818_dhx_editor_status=deleted&ids=14818
TypeError: f is undefined

…eDayEvent=function(b){return b.rec_type?!0:a.call(this,b)};var b=c.updateEvent;c…

dhtmlx…ring.js (line 23)

Hello,
the response seems correct.
Try the most recent version of the component, does the issue happens there?
s3.amazonaws.com/uploads.hipcha … 140129.zip

I tried the new version and rolling back to previous versions. That didn’t work.

But I think I’m on a path to another solution, maybe I could get a suggestion to make this work.

Problem 1 - Clicking on the dialog box icon before you click on the checkmark icon causes everything to freeze

Possible solution: Disable the dialog box icon somehow unless the check mark was clicked first? (I guess that means disable unless and event has been saved first)

Problem 2 - If you click delete it proceeds to bring up my confirmation and then doesn’t do anything.

Possible solution: Disable the delete icon if the event doesn’t exist yet? I was thinking of removing the trash icon (delete icon) completely but it actually works as intended when there’s an event record.

So I’m hoping I can find a suggestion for those two question(mark)s

TIA,

David

*oddly enough when you click outside the event it disappears which is exactly what I want the delete to do

I figured out a work around for the problems with the lightbox hanging.

I put this setting so the lightbox comes up directly on create.

Seems like if I save from within the lightbox everything is ok.

scheduler.config.details_on_create=true;

But I still don’t understand why the ‘Delete’ icon doesn’t clear the event off the screen. If I click on a new event or something, then it clears the event, which is the behavior I’m looking for?

-D

I figured out a solution to the deletion problem by putting a

$connector->render();

In my Codeigniter delete function.

It puts a black strike-through the header and doesn’t make it vanish.

But, I’ll try and sell that behavior to my boss.

-D

If you have some kind of the online demo, where the problematic behavior can be checked - please share the link.

dgriffis,

Are you building the response by yourself? If so, did you check the Content-Type is set to text/xml?

I had some odd behaviour with dhtmlxscheduler before checking that.

Unfortunately, it’s behind a firewall and has proprietary case information. Now that I click and go directly into the lightbox I’m bypassing the issue.

Thanks so much,

David

Unfortunately it’s a restricted internal app. Now, I’m not deleting at all. Just set a flag to cancelled and filter it. By going directly into the lightbox I can cancel and when it exits it’s gone. So I resolved the issue by avoiding it.

Thanks,

David

It is problematic to suggest any solution without checking the problematic code.

From the above description - it really may be some problem with server side processing | response. If server side sends wrong response ( not xml, not valid format, etc. ) client side will mark item as “delete” ( strike through ) but will not remove them fully.