Search
18504 results 2951-2960
Forum
- 26th Nov 2012Server side ajax table with fix heightI am having a problem trying to set the height of my table. Here is the code: var oTable = $('#example').dataTable({ "sScrollY": "700px", "sAjaxSource": "../AjaxHandlerRules", "bServerSide": true, "sDom": "frtiS", "bInfo": false, "iDisplayLength": 100, ..... I want the table to display with 700px height with scrollY. The AjaxHandlerRules returns me a Json object. Thanks in advance, Matias
- 14th Oct 2012C# Simple Ajax Example Gets JSON Formatting ErrorThis is the most basic example that I can think of. I'm manually creating the JSON in a string to pass back to data tables call. The JSON returned certainly looks to be well formed, but DataTables is throwing the error: 'DatatTables warning (table id='table_id'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.' The JSON returned in the response, captured in Firefox/Firebug is as follows: {"sEcho": 1,"iTotalRecords": "2","iTotalDisplayRecords": "2","aaData":[["Vendor1","10","20","30","50"],["Vendor1","10","20","30","50"]]} This seems to be a valid JSON string as per the DataTables documentation. Can anyone tell me what is going wrong here? The HTML Page: <style type="text/css" title="currentStyle"> @import"/Styles/demo_table.css"; @import"/Sytels/demo_page.css"; </style> <script type="text/javascript"> var oTable; $(document).ready ( function () { $("#table_id").dataTable({ "bProcessing": true, "bServerSide": true, "sAjaxSource": "WebForm1.aspx" }); }); Vendor Past 7 Days Past 24 Hours Past Hour Rejects Outstanding > The ASPX Code Behind: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; using System.Web; using System.Web.UI; using System.Data; using System.Data.SqlClient; using System.IO; namespace DataTablesInWebApplication { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, System.EventArgs e) { string dtJSONString; dtJSONString = @"{"; dtJSONString = dtJSONString + @"""sEcho"": " + Request["sEcho"] + ","; dtJSONString = dtJSONString + @"""iTotalRecords"": ""2" + @""","; dtJSONString = dtJSONString + @"""iTotalDisplayRecords"": ""2" + @""","; dtJSONString = dtJSONString + @"""aaData"":["; dtJSONString = dtJSONString + "[" + @"""Vendor1""," + @"""10""," + @"""20""," + @"""30""," + @"""50""],"; dtJSONString = dtJSONString + "[" + @"""Vendor1""," + @"""10""," + @"""20""," + @"""30""," + @"""50""]"; dtJSONString = dtJSONString + "]}"; HttpContext.Current.Response.Write(dtJSONString); }
- 4th Oct 2012DataTables Not Reloading with Ajax callI have a situation where on selection of value from a drop down the content table to be fetched. For first selection its loads the data properly but after that if i select another element then the function is being called and alert is also coming but datatable is not fetching the data again. function selectCountry(Country) { ctry = Country.value; window.alert(Country.value); $("#SellOut").dataTable({ "sPaginationType": "full_numbers", "sAjaxSource" : 'dataentryconfig/FetchConfigTable.html?Country='+Country.value, "bJQueryUI": true, "sAjaxDataProp" : 'sellout', "aoColumns" : [ { mDataProp : 'fieldId' , "fnRender": function ( oObj ) { if(oObj.aData["fieldId"]!=null){ return '<input type="text" value="'+oObj.aData["fieldId"]+'" readonly="readonly">'; } } },{ mDataProp : 'displayTitle' , "fnRender": function ( oObj ) { if(oObj.aData["displayTitle"]!=null){ return '<input type="text" value="'+oObj.aData["displayTitle"]+'" readonly="readonly">'; } } }, { mDataProp : 'mandatory' , "fnRender": function ( oObj ) { if(oObj.aData["mandatory"]=='Y'){ return '<input type="checkbox" disabled="disabled" checked="true"> '; } else { return '<input type="checkbox" disabled="disabled" > '; } } } ,{ mDataProp : 'configId' , "fnRender": function ( oObj ) { if(oObj.aData["configId"]!=null){ return '<input type="text" value="'+oObj.aData["configId"]+'" readonly="readonly">'; } else { return '<input type="text" value=" " readonly="readonly"> '; } } }, { mDataProp : 'inputMandatory', "fnRender": function ( oObj ) { if(oObj.aData["inputMandatory"]=='Y'){ return '<input type="checkbox" checked="true" > '; } else { return '<input type="checkbox" value=" " > '; } } } , { mDataProp : 'visible' , "fnRender": function ( oObj ) { if(oObj.aData["visible"]=='Y'){ return '<input type="checkbox" checked="true"> '; } else{ return '<input type="checkbox" value=" " > '; } } } ,{ mDataProp : 'defaultValue', "fnRender": function ( oObj ) { if(oObj.aData["defaultValue"]!=null){ return '<input type="text" value='+oObj.aData["defaultValue"]+'> '; } else { return '<input type="text" value=" "> '; } } } , { mDataProp : 'ctryTitle' ,"fnRender": function ( oObj ) { if(oObj.aData["ctryTitle"]!=null){ return '<input type="text" value='+oObj.aData["ctryTitle"]+'> '; } else { return '<input type="text" value=" "> '; } } } ], "bRetrieve" : true, "bDestroy" : true }); Please help
- 1st Oct 2012Not able to display JSON data sent from serverside to Datatable with ajax callPlease help, i have tried everything. JS Bin link - http://live.datatables.net/iqisuz/2/edit#javascript,html Debugger character reference - acuyoq
- 25th Jun 2012ajax request : Make join with another fieldhi, For each line of my datatable, i try to join another mysql table and display it in each row. How can get it ? thanks
- 24th May 2012Performance Issues with IE8 + DeferRender + Ajax - Part 2aoColumnDef structure: [code] var colsdef = [ { "fnRender": function (o, val) { return "" + o.aData["col1"] + ""; }, "bUseRendered": false, "aTargets": [0] }, { "fnRender": function (o, val) { return "" + o.aData["col3"] + ""; }, "bUseRendered": false, "aTargets": [2] }, { "fnRender": function (o, val) { return "" + o.aData['col6'] + ""; }, "bUseRendered": false, "aTargets": [4] }, { "fnRender": function (o, val) { return "" + o.aData['col9'] + ""; }, "aTargets": [9] }, { "fnRender" : function (o, val) { return "" + o.aData['col10'] + ""; }, "bUseRendered": false, "aTargets" : [10] }, { "fnRender" : function (o, val) { return "" + o.aData['col14'] + ""; }, "bUseRendered": false, "aTargets": [14] }, { "fnRender": function (o, val) { return "" + o.aData['col15'] + ""; }, "bUseRendered": false, "aTargets": [15] }, { "fnRender": function (o, val) { return "" + o.aData['col16'] + ""; }, "bUseRendered": false, "aTargets": [16] }, { "fnRender": function (o, val) { return "" + o.aData['col17'] + ""; }, "bUseRendered": false, "aTargets": [17] }, { "fnRender": function (o, val) { return "" + o.aData['col18'] + ""; }, "bUseRendered": false, "aTargets": [18] }, { "fnRender": function (o, val) { return "" + o.aData['col19'] + ""; }, "bUseRendered": false, "aTargets": [19] }, { "fnRender": function (o, val) { return " View Add " + o.aData['daysSinceLastReview'] + " "; }, "bUseRendered": false, "aTargets": [27] } ] [/code] -- See Part 3
- 21st May 2012dataTable with ajax and extra data but in server side get undefinedFirst, thanks for ur help. I'm new here and thanks for the great tool dataTables. This is my config about my problem [code] $('a#calculate').bind('click',function(){ $('#example').dataTable({ "bProcessing": true, "bDestroy": true, "bServerSide": true, "sAjaxSource": "/_calc_netflow", "fnServerData": function ( sSource, aoData, fnCallback ) { aoData.push({ 'choice':$('#choice').val(), 'start':$('#start').val(), 'end':$('#end').val() }) $.getJSON(sSource,aoData,fnCallback) } }); }); [/code] when i use it , i get error in my server-side: [code] 192.168.108.13 - - [21/May/2012 14:01:21] "GET /_calc_netflow? sEcho=1&iColumns=3&sColumns=&iDisplayStart=0&iDisplayLength=10&mDataProp_0=0&mDataProp_1=1 &mDataProp_2=2&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1= &bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&iSortCol_0=0& sSortDir_0=asc&iSortingCols=1&bSortable_0=true&bSortable_1=true&bSortable_2=true&undefined=undefined HTTP/1.1" [/code] i search whole this side but i couldn't find answer. Does any here help me?
- 18th May 2012Request: Virtual Scrolling / DeferredLoading + $.Ajax Example (Closed)-- Edited -- Reason : Found it on some external website.
- 16th May 2012Recreating a table using AJAX and a table coming from a PHP pageHi, this is my first post. Great plugin, by the way. I am using the DataTables.net v.1.9 and the latest version for JQuery. I am actually loading the page with the table and it works fine. Now the problem is that I would like to recreate the table using a table coming from a PHP file (the actual content result is the HTML table). I'm using: $(".tableclass").load("url") in order to get the html table. After this step, I recreate the table and i replace the previous table with the new one doing a second call of datatable(options). First I got a warning message about the table can't be initialized and the message suggests to see documentation for bRetrieve or bDestroy. Than I set them true and the table is replaced correctly when i click on the trigger button, but all the plugin features are not applied to the table. Before I go on, can anyone please tell me if my goal can be achieved using Datatables or not? Thanks
- 14th May 2012Specifying Columns with AJAX Source doesn't workI have a PHP script which is returning the aaData and aaColumns data to create a table, with the specified titles. Using the code below I get an error that oColumn is undefined (with a blank table): [code] $('#example').dataTable( { "bProcessing": true, "sAjaxSource": 'script.php' } ); [/code] As a workaround, I am instead successfully using: [code] $.getJSON('script.php', {}, function(data) { $('#example').dataTable( data ); }); [/code] Is there a reason why the JSON call can't accept a list of columns in the same format as a direct call? Or is there a different format that's preferred for specifying table columns in the JSON object? If not, I humbly suggest adding this as an option in the next release.