Server-side/MS SQL question

Server-side/MS SQL question

StpdudeStpdude Posts: 30Questions: 0Answers: 0
edited January 2013 in General
Hey guys, i need a bit of help getting my server-side-processing code working. Ill start out by saying im new to DataTables, as well as the programming field in general so please pardon me if my questions are REALLY dumb :) So my current task at work is making a web interface to view/edit data from our server. Its a MS SQL server and they are having me use DataTables for the web end. So far ive gotten it so that it reads and displays correctly. Right now I am trying to implement it so that it sends back the add/delete/edit commands correctly but after a couple weeks of working on it and reading on here, have had 0 luck. Here is my current code:
[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() {
$('#demo').html( '' );

var editor = new $.fn.dataTable.Editor( {
"ajaxUrl": "dataTable/edit",
"domTable": "#example",
"fields": [ {"label": "ID:","name": "id"},
{"label": "Version:", "name": "version" },
{"label": "Name:", "name": "name" },
{"label": "Application Name:", "name": "applicationName" },
{"label": "Application Version:", "name": "applicationVersion" },
{"label": "Availability:", "name": "availability" },
{"label": "Baseline Load:", "name": "baselineLoad" },
{"label": "Color", "name": "color"},
{"label": "Implementation ID", "name": "implementationId"},
{"label": "Quantity", "name": "quantity"},
{"label": "Label", "name": "label"},
{"label": "Location", "name": "location"},
{"label": "Application Owner", "name": "applicationOwner"},
{"label": "Architecture Owner", "name": "architectureOwner"},
{"label": "Data Owner", "name": "dataOwner"},
{"label": "Is Ola Agreed?", "name": "isOlaAgreed"},
{"label": "Is Recognized", "name": "isRecognized"},
{"label": "Is Strategic", "name": "isStrategic"},
{"label": "Resolved Time UTC", "name": "resolvedTimeUtc"}
]
} );

$('#example').dataTable( {
"bJQueryUI": true,

"sPaginationType": "full_numbers",
"iDisplayLength": 5,
"sDom": 'T<"H"fl>t<"F"ip>',
"sAjaxSource": 'dataTable/getData',
"aoColumns": [
{ "mData": "id", "sTitle": "ID" },
{ "mData": "version", "sTitle":"Version" },
{ "mData": "name", "sTitle": "Name" },
{ "mData": "applicationName", "sTitle": "Application Name" },
{ "mData": "applicationVersion", "sTitle": "Application Version" },
{ "mData": "availability", "sTitle": "Avaliblity" },
{ "mData": "baselineLoad", "sTitle": "Baseline Load"},
{ "mData": "color", "sTitle": "Color"},
{ "mData": "implementationId", "sTitle": "Implementation ID"},
{ "mData": "quantity", "sTitle": "Quantity" },
{ "mData": "label", "sTitle": "Label" },
{ "mData": "location", "sTitle": "Location" },
{ "mData": "applicationOwner", "sTitle": "Application Owner" },
{ "mData": "architectureOwner", "sTitle": "Architecture Owner" },
{ "mData": "dataOwner", "sTitle": "Data Owner" },
{ "mData": "olaAgreed", "sTitle": "Is OLA Agreed" },
{ "mData": "recognized", "sTitle": "Is Recognized?" },
{ "mData": "strategic", "sTitle": "Is Strategic?" },
{ "mData": "resolvedTimeUTC", "sTitle": "Resolved Time UTC" },
],
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
} );
});












[/code]

Now based on everything I've read and had told to me, i need to put in [code] bServerSide: true, sServerMethod: 'POST' [/code] problem right now is how my work had me set this up i use [code] "sAjaxSource": 'dataTable/getData', [/code] not a PHP file. According to the examples on here (http://datatables.net/examples/data_sources/server_side.html) I need to use a PHP file. Now first off i cant quite tell if the section of PHP posted in the example is supposed to be the entire code, or just added to a pre-existing Server_processing.php file. Now either way.....im not sure how to combine having to use a PHP with our /getData method.....

Anyone with any clues on what i could try?

Replies

  • StpdudeStpdude Posts: 30Questions: 0Answers: 0
    Further, if i switch it over to the server_processing.php file, fill it with all the correct info, the best it ever does is give me an error back saying its not in correct JSON format, and inspecting the data in firebug shows that it jsut fed back the text of the entire file....rather then using anything in it, just treated it as text....
  • StpdudeStpdude Posts: 30Questions: 0Answers: 0
    Anyone got any clues? :)
This discussion has been closed.