redrawing after delete

redrawing after delete

StpdudeStpdude Posts: 30Questions: 0Answers: 0
edited January 2013 in General
So right now my code has a button which makes a aJax call to our delete function, which removes a row by its ID. The problem is that while the delete works.....it does not refresh the table. i saw the fnDraw(), and fnReloadAjax() commands. but havent been able to figure out how to place them to get them to work correctly, currently my code is:

[code]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ page session="false" %>










$(document).ready(function(){
var oTable = $('#dataTable').dataTable({
"bProcessing": true,
"bJQueryUI": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 5,
"sDom": 'T<>rt',
"sAjaxSource": 'dataTable/getCmsGroupData',
"aoColumns": [
{ "mData": "id", "sTitle": "ID" },
{ "mData": "version", "sTitle":"Version" },
{ "mData": "name", "sTitle": "Name" },
{ "mData": "description", "sTitle": "Description"},
{ "mData": "notes", "sTitle": "Notes"},
],
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [{
"sExtends": "ajax",
"bSelectedOnly": "true",
"sButtonText": "Delete Selected",
"mColumns": [0],
"bHeader": false,
"sAjaxUrl": "dataTable/delete/cmsGroup",
}]//Delete button
}//table tools

});//DataTable
}); //function





CMS Group













[/code]

the user selects one or more rows, clicks delete, they delete and the tabletools pops up a window informing the user that it processed right, and so i need it to refresh right there....any clues?

Replies

  • StpdudeStpdude Posts: 30Questions: 0Answers: 0
    edited January 2013
    OK so after some tinkering i got it half-working, changed code to:
    [code]

    $(document).ready(function(){



    $.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
    {
    //alert(sNewSource);

    if ( typeof sNewSource != 'undefined' && sNewSource != null )
    {
    oSettings.sAjaxSource = sNewSource;
    }
    this.oApi._fnProcessingDisplay( oSettings, true );
    var that = this;
    var iStart = oSettings._iDisplayStart;
    var aData = [];

    this.oApi._fnServerParams( oSettings, aData );

    oSettings.fnServerData( oSettings.sAjaxSource, aData, function(json) {
    /* Clear the old information from the table */
    that.oApi._fnClearTable( oSettings );

    /* Got the data - add it to the table */
    var aData = (oSettings.sAjaxDataProp !== "") ?
    that.oApi._fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ) : json;

    for ( var i=0 ; i
  • StpdudeStpdude Posts: 30Questions: 0Answers: 0
    Anyone have any clue whats causing this?
This discussion has been closed.