Quantcast
Channel: DataTables 1.9 — DataTables forums
Viewing all 1816 articles
Browse latest View live

Column alignment messed up when paging turned off

$
0
0
DataTables is working fine for some simple tables I have it implemented for, but when I attempt to turn off paging via the following initialization call:

$("#reviewtable").dataTable({
"sScrollY": "500px",
"bPaginate": false});

the column alignment is messed up with the data fields not aligning with the headers.

Is there some other parameter to set that I'm missing? Thanks for any help

column sizing and resizing

$
0
0
I have a fixed-width DataTable. I want to give the user the ability to switch this layout from "fixed" to "fit" layout. Is there a way to have datatable re-layout the columns without clearing and reinitializing the table.
See the fiddle: http://jsfiddle.net/sEXbs/1/
(The fiddle shows a static version - in production, I will be using an ajax datasource and allow for column selection.)
Also, I noticed that that DataTables seems to pick different values for the widths. In the fiddle above, the first few values are 27, while the last few are 28. (In some cases, I've seen 4 different numbers, gradually changing for each group of columns.)

problem after recreate

$
0
0
It seems like I can't find a proper way to destroy Datatable. When I click on it, I get so much onclick events as how many times Datatable is recreated. Put this in /examples/data_sources/ajax.html:

var oTable = '';
var columns = [	{ "sTitle": "Rendering engine", "sWidth": "20%", "sClass": "center" },
			    { "sTitle": "Browser", "sWidth": "25%" },
			    { "sTitle": "Platform(s)", "sWidth": "25%", "sClass": "center" },
			    { "sTitle": "Engine version", "sWidth": "15%", "sClass": "center" },
			    { "sTitle": "CSS grade", "sWidth": "15%", "sClass": "center" }
];

function tableEmpty() {
	oTable.fnDestroy();
	$("#example").empty();
}

function tableCreate() {
			
	oTable = $('#example').dataTable( {
		"bProcessing": true,
		"aoColumns": columns,
		"sAjaxSource": '../ajax/sources/arrays.txt'
	} );

	$(document).on("click", "#example tbody tr", function(e){
		cell_text = $("td:eq(0)", this).text();
		alert("cell_text:"+cell_text);
	});
}

<div id="container">
	<div class="full_width big">
		DataTables AJAX source example
	</div>
			
	<h1>Preamble</h1>
	<p><a style="cursor: pointer;" onclick = "tableEmpty()">Table empty</a></p>
	<p><a style="cursor: pointer;" onclick = "tableCreate()">Table create</a></p>
			
	<h1>Live example</h1>
	<div id="dynamic">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
</table>
	</div>

</div>

I want a single alert every time. How can I achieve that?

Date Range Filtering

$
0
0
Hi Allan,

I am going to be needing a filtering option for dates.

I found this :

http://jquery-datatables-column-filter.googlecode.com/svn/trunk/dateRange.html

Is that plugin still being supported by you/datatables?

Furthermore I need the UI to select a dates in this format :

yyyy-mm-dd

to the best of my knowledge of reading the documents this can be done by :

 $.datepicker.regional[""].dateFormat = 'dd/mm/yy';
                $.datepicker.setDefaults($.datepicker.regional['']);


but I do not see where I am supposed to change these settings? - If this plugin is still supported obviously.

Thanks,
Allan.

Twitter Bootstrap (V2) style not displayed

$
0
0
Hi, i followed this post (http://www.datatables.net/blog/Twitter_Bootstrap_2) in order to make DataTables look like the table of Twitter Bootstrap. But for some reason i can't get the TB style applied to my DataTable.

I followed everything in that post. I basically have this:

<style>
table.table thead .sorting,
table.table thead .sorting_asc,
table.table thead .sorting_desc,
table.table thead .sorting_asc_disabled,
table.table thead .sorting_desc_disabled {
    cursor: pointer;
    *cursor: hand;
}

table.table thead .sorting { background: url('../images/datatable/sort_both.png') no-repeat center right; }
table.table thead .sorting_asc { background: url('../images/datatable/sort_asc.png') no-repeat center right; }
table.table thead .sorting_desc { background: url('../images/datatable/sort_desc.png') no-repeat center right; }
 
table.table thead .sorting_asc_disabled { background: url('../images/datatable/sort_asc_disabled.png') no-repeat center right; }
table.table thead .sorting_desc_disabled { background: url('../images/datatable/sort_desc_disabled.png') no-repeat center right; }

</style>


<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('#example').dataTable( {
            "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>"
        } );
    } );
    
    $.extend( $.fn.dataTableExt.oStdClasses, {
        "sWrapper": "dataTables_wrapper form-inline"
    } );
</script>

Below that i simply have a table with all the data in it:

<table cellpadding="0" cellspacing="0" border="0" class="table" id="example">
...
</table>

But for some reason i get the "original" look instead of the Twitter Bootstrap look.

Here's a screenshot: http://imgur.com/EVI12

I want to point out that Twitter Bootstrap IS included in the <head> of my page. As you can also see in the screenshot, the span6 is picked up by it (where the "Search" and "Show entries" is displayed and also at the bottom.

Also the Pagination at the button isn't looking like it should.

Any idea what the problem could be...??

Ajax array Sorting

Strange issue with IE8 with 1.9.4

$
0
0
I'm having a strange issue with IE8 - our corporate standard (at least it's not IE6) - in _

fnCalculateColumnWidths ( oSettings ) line 3565 -
    var iColums = oSettings.aoColumns.length;
In IE9, IE10, Firefox and Chrome for my table it returns 8, in IE8 it returns 9, and then proceeds to throw up errors around line 3654
      nThs[i - iCorrector].style.width = ""; 
with property is undefined.

Only happening in IE8 in IE8 standards mode. There don't seem to be any obvious differences. I'm using twitter bootstrap.
        var asInitVals = new Array();
        $(document).ready(function () {

            var oTable = $('#main').dataTable(
            {
                "bPaginate": true,
                "bLengthChange": true,
                "bFilter": true,
                "bSort": true,
                "bInfo": true,
                "bProcessing": true,
                "bServerSide": true,
                "bStateSave": true,
                "sAjaxSource": "/UserProfile/GetUserProfiles",
                "aaSorting": [[2, 'asc'], [1, 'asc']],
                "aoColumns": [null, null, null, null, null, null, null,
                                {
                                    "sName": "x",
                                    "fnRender": function (oObj) {
                                        return "<div class='btn-group'>" +
                                            "<a href='/userProfile/edit/" + oObj.aData[7] + "' class='btn btn-success btn-small'>Edit</a>";
                                    }
                                }, ],
                "sDom": "<'row'<'span6'l><'span6'f>r>t<'row'<'span6'i><'span6'p>>",
                "sPaginationType": "bootstrap",
                "oLanguage": { "sLengthMenu": "_MENU_ records per page" },
                "sScrollY": "400px",
            });
        });

Column sorting reset on third click?

$
0
0
Does anyone have an example of setting the table up so that it resets the sorting on a third click? So click 1 sorts ascending, click #2 descending, then click #3 would remove the sorting on that column (and revert to the original order if need be).

Freeze sorting function

$
0
0
Hi there.
I am working on project that is using DataTables 1.9. I created simple edit row function, which is based on getting data (form) from server via ajax. When i retrieve data for edited row i use function .fnUpdate() to instert form to edited row. Everything work fine, but datatables run sorting actions and move edited row to the top of the table. Is there any possibility to temporary deactivate sorting when row edit is active?

fixed row height in the table

$
0
0
Hi,
I wanted a fixed row height. However, each td element contains data which is overflowing, comes to the next line & consequently increases the height of the row. Is there a way to fix the height of the row.
I also tried to insert a div element inside the function & use the foll css:-

table#example tbody td div{
width:160px;
height:28px;
overflow:hidden;
word-wrap:break-word;
}

It did fixed the height & width of the div element inside the td element, but caused a break in the nTd variable & hence also the iRow variable remained undefined. Any workaround would be appreciated.

Thanks for looking.

Removing column and related row data using drag and drop

$
0
0
hi all,
I am using tree view and data Table;when i am drag a node from tree view to html table;its become a column for table;that i am binding to data table;but i am getting duplication of table header data into rows and;i added http://www.danvk.org/dragtable/dragtable.js script for making my table drag and drop but i am unable to drag the dynamic columns and related rows;
and i want one more functionality i.e. if i drag my column on to the tree view column has to be deleted.


please guide me in this...
Thanks in advance

"sPaginationType": "full_numbers" shows up clustered

$
0
0
Hello Guys,

I have recently downloaded Datatables 1.9.4 and tried using it on table with spagination option with full numbers. The table appears with the first,next and page numbers closer and looking awkward.

I tried the solution given in of the forums to increase the height of the line by

.dataTables_paginate {
width: 400px;
height: 22px;
line-height: 22px;
}

But it didn't work for me , I'm using IE 8.0.6 version. Please suggest

Thanks
Kranthi

Killing a request

$
0
0
I have a "details view" combined with a polling application. The code is already in place to stop polling when someone opens a details row.

However...

A race condition can be created whereby the request is sent out, the user clicks an "open details" icon, and then the request returns. When the request returns, the table is re-rendered and therefore the details view is re-closed.

I did a bit of poking around and discovered that if I call .abort() on the XHR object, it will cancel normal (plain ol' $.ajax()) requests, but I"m not sure where the DT API hooks into the returned data or if that will ruin things. Also, I'm not sure how to access the XHR object, because my "oTable" variable (I name it differently, but in the convention of the example code here) is a DT object, not an XHR object.

What I would like to do is this:

$('#wrapper').on('click', '.details_button', function(e) {
  e.preventDefault();
  xhr.abort(); // I do not actually know how to grab the xhr object, though
  do_the_rest_of_my_stuff();
});

If I can dynamically get the DT object and then get the XHR object from within, that would be the best route (ie. using 'this' to navigate to the DT object). But I don't mind doing it with my oTable variable, either.

Thanks!

Notice: Undefined index: sEcho (sEcho is passed in request though)

$
0
0
Upon trying to sort or filter data from a Datatable using the server_side processing script on the example page, I am given the following error:

Notice: Undefined index: sEcho

And the JSON output returned is:
{"sEcho":0,"iTotalRecords":"2","iTotalDisplayRecords":"2","aaData":[["DC2610","3"],["DC2611","3"]]}

This does not make sense to me, because according to the network tab of Chrome, when I try to sort the data a request is handed off with sEcho being equal to 2 as seen below:

http://localhost/people-app/products/auxRoom.php?sEcho=2&sColumns=room%2Ccapacity&iDisplayStart=0&iDisplayLength=25&sSearch=&iSortCol_0=1&sSortDir_0=asc&iSortingCols=1&ajax=products&visibleColumns=0%2C1

The above is made in the form of a GET request. If it matters I am using the Yii framework, though I don't think that is related. I am using the exact code from the server side scripting example, with the MySQL info changed of course (including columns).

Any reason why this may not be working?


Edit:
I am using Datatables and here are the settings that should be being used currently:
	$.fn.eDataTables.defaults = {
		jqxhr: null,
		ajaxUpdate: [],
		pagerClass: 'pager',
		loadingClass: 'loading',
		filterClass: 'filters',
		tableClass: 'items',
		selectableRows: 1,
		editableSelectsRow: true,
		relatedOnlyOption: false,

		ajaxOpts: {},

		bProcessing: true,
		bServerSide: true,
		bStateSave: false,
		bAutoWidth: false,
		bJQueryUI: true,
		sPaginationType: "full_numbers",
		//aaSorting: [[0, "asc"]],
		iDisplayLength: 25,
		editable: {
			string: {},
			integer: {},
			boolean: {}
		},
		buttons: {},
		filterForm: null,
		filterSerializeCallback: function(f){return f.serializeArray();}
	};

Ajax call is made later.

Eliminating the sorting icons from column rows

$
0
0
I have tried searching for this in various ways and haven't found anything relevant so I am posting this as a question and hopefully someone can help out.

I have sorting enabled using "bSortable" in "aoColumnDefs" and defined like so:

"aoColumnDefs": [
{ "bSortable": false, "aTargets": [0] },                      
{ "bSortable": true, "sWidth": '100px', "aTargets": [1] },
{ "bSortable": true, "sWidth": '110px', "aTargets": [2] },
{ "bSortable": true, "sWidth": '100px', "aTargets": [3] },
{ "bSortable": false, "aTargets": [4] },                      
{ "bSortable": true, "sWidth": '100px', "aTargets": [5] },
{ "bSortable": true, "sWidth": '100px', "aTargets": [6] },
{ "bSortable": true, "sWidth": '200px', "aTargets": [7] },
{ "bSortable": true, "sWidth": '100px', "aTargets": [8] }
 ],

The "bSortable" option causes all the rows that have sorting enabled to display the sorting icon on each row. I just want the sorting icon to appear in the header for the columns that need to be sorted. I am not sure if there is something I am doing wrong in the I am defining it above or should I target this in CSS and somehow force it not to display the icons in the rows.

Thank You.

Filtering server side data

$
0
0
Hi
I have a table which is populated by the following script. When I click on a row, I can go to another page, in this case "pay_invoices.php" and using the get method, the row id is sent across.No problems here, the code is below
 
 var oTable;
$(document).ready( function () {
    oTable = $('#tbl_purchase_invoices').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "datatables_data/purchase_invoice_data.php",
        "aoColumns": [
            { "bVisible": true },
            null,
            null,
            null,
            null
        ],
        "fnDrawCallback": function ( oSettings ) {
            $('#tbl_purchase_invoices tbody tr').each( function () {
                var iPos = oTable.fnGetPosition( this );
                $(this).click( function () {
                    window.location = "pay_invoice.php?id="+oSettings.aoData[iPos]._aData[1];
                } );
            } );
        }
    } );
} );

My problem arises when I introduce the two lines to filter the data returned from the server, below the line starting "sAjaxSource"

 var oTable;
$(document).ready( function () {
    oTable = $('#tbl_purchase_invoices').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "datatables_data/purchase_invoice_data.php",
		
		 "fnServerParams": function ( aoData ) {                                                 //THIS LINE 
	  aoData.push( { "name": "company_id", "value":"<?php echo $comp_id; ?>"}, //& THIS LINE
		
        "aoColumns": [
            { "bVisible": false },
            null,
            null,
            null,
            null
        ],
        "fnDrawCallback": function ( oSettings ) {
            $('#tbl_purchase_invoices tbody tr').each( function () {
                var iPos = oTable.fnGetPosition( this );
                $(this).click( function () {
                    window.location = "pay_invoice.php?id="+oSettings.aoData[iPos]._aData[1];
                } );
            } );
        }
	
    } );
} );


When I introduce these two lines, the table stops rendering. I can render the table using the aoData without the fnDrawCallback or I can render the table with fnDrawCallback and no aoData filter, but not together. It is I suspect, a matter of closing braces, but for the life of me and all day spent at it, I'm no closer to sorting it.

Any help would be gratefully received.

David

Server Side Pagination -- buttons disabled

$
0
0
Hi,

I am using DataTables on front end talking to a Java Server via REST. I can populate the tables etc but I am having difficulty getting pagination working. I am unsure what to set when returning. I have tried a number of different approaches, all failed...The server code below

1. reads in iDisplayStart and iDisplayLength sent from GUI
2. queries DB for all data (ignoring iDisplay values)
3. Selects a subset of results set based on iDisplayStart and iDisplayLength
4. Sets this subset as the return list
5. sets setiTotalDisplayRecords = to the trimmed down list (from start to display length)
6. sets setiTotalRecords = total list returned from DB
7. returns,...


If i return the subset(trimmed list), this is all that's displayed but pagination buttons are disabled
If i return total data, this gets displayed and pagination buttons disabled

Any help much appreciated,
T

 
@GET
    @Produces("application/json")
    public String getRecords(@PathParam("userId") final Long userId, @QueryParam("sEcho") final int sEcho, @QueryParam("iDisplayStart") final int iDisplayStart, @QueryParam("iDisplayLength") final int iDisplayLength  ) throws IOException {
		logger.info("retreiving records for a customer with a user of id : " + userId);
		logger.info("QueryParameters: sEcho: "+sEcho+ " start: "+iDisplayStart+ " length: "+iDisplayLength);
		
		//int ssEcho = sEcho+1;
		int displayLength=iDisplayLength;
		
		//final List<Record> results = dao.getRecordsForCustomer(userId, iDisplayStart, iDisplayLength);	
		final List<Record> results = dao.getRecordsForCustomer(userId);

		logger.info("Total Returned list from database: "+results.size());
		if(iDisplayLength<results.size()){
			
			//no probs
		}
		else{
			logger.info("Less results exist than requested, setting iDisplayLength to: "+results.size());
			displayLength=results.size();
		}
		final List<Record> trimmedResultList = results.subList(iDisplayStart, displayLength);
		logger.info("trimmedResultList list of size: "+trimmedResultList.size()+" start: "+iDisplayStart+" length: "+displayLength);
		
		final ObjectMapper mapper = new ObjectMapper();
		//returning trimmed list
		final DisplayDataRecord[] records = convertToDisplayRecords(trimmedResultList); 
		final AAData aaData = new AAData();
		aaData.setsEcho(sEcho);
		aaData.setiTotalDisplayRecords(trimmedResultList.size());
		aaData.setiTotalRecords(results.size());	
		//aaData.setiDisplayStart(iDisplayStart);
		//aaData.setiDisplayLength(iDisplayLength);
		aaData.setAaData(records);
		return mapper.writeValueAsString(aaData);


Classic ASP Datatables

$
0
0
Dear Great Gurus

I am using Classic ASP Datatables with json to fetch data .

My issues are
1) Datatables are not Refreshed.
2) A Very Slow response of Datatables(I have 10000+ Records in the table.)

Please help me in winning this situation..Thanks in Advance

Below is my Code.

[CODE]

<script type="text/javascript" charset="utf-8">
var oCache = {
iCacheLower: -1
};

function fnSetKey( aoData, sKey, mValue )
{
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
{
if ( aoData[i].name == sKey )
{
aoData[i].value = mValue;
}
}
}

function fnGetKey( aoData, sKey )
{
for ( var i=0, iLen=aoData.length ; i<iLen ; i++ )
{
if ( aoData[i].name == sKey )
{
return aoData[i].value;
}
}
return null;
}

function fnDataTablesPipeline ( sSource, aoData, fnCallback ) {
var iPipe = 20;
var bNeedServer = false;
var sEcho = fnGetKey(aoData, "sEcho");
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
var iRequestLength = fnGetKey(aoData, "iDisplayLength");
var iRequestEnd = iRequestStart + iRequestLength;
oCache.iDisplayStart = iRequestStart;

/* outside pipeline? */
if ( oCache.iCacheLower < 0 || iRequestStart < oCache.iCacheLower || iRequestEnd > oCache.iCacheUpper )
{
bNeedServer = true;
}


if ( oCache.lastRequest && !bNeedServer )
{
for( var i=0, iLen=aoData.length ; i<iLen ; i++ )
{
if ( aoData[i].name != "iDisplayStart" && aoData[i].name != "iDisplayLength" && aoData[i].name != "sEcho" )
{
if ( aoData[i].value != oCache.lastRequest[i].value )
{
bNeedServer = true;
break;
}
}
}
}


oCache.lastRequest = aoData.slice();

if ( bNeedServer )
{
if ( iRequestStart < oCache.iCacheLower )
{
iRequestStart = iRequestStart - (iRequestLength*(iPipe-1));
if ( iRequestStart < 0 )
{
iRequestStart = 0;
}
}

oCache.iCacheLower = iRequestStart;
oCache.iCacheUpper = iRequestStart + (iRequestLength * iPipe);
oCache.iDisplayLength = fnGetKey( aoData, "iDisplayLength" );
fnSetKey( aoData, "iDisplayStart", iRequestStart );
fnSetKey( aoData, "iDisplayLength", iRequestLength*iPipe );

$.getJSON( sSource, aoData, function (json) {
/* Callback processing */
oCache.lastJson = jQuery.extend(true, {}, json);

if ( oCache.iCacheLower != oCache.iDisplayStart )
{
json.aaData.splice( 0, oCache.iDisplayStart-oCache.iCacheLower );
}
json.aaData.splice( oCache.iDisplayLength, json.aaData.length );

fnCallback(json)
} );
}
else
{
json = jQuery.extend(true, {}, oCache.lastJson);
json.sEcho = sEcho; /* Update the echo for each response */
json.aaData.splice( 0, iRequestStart-oCache.iCacheLower );
json.aaData.splice( iRequestLength, json.aaData.length );
fnCallback(json);
return;
}
}

$(window).bind('resize', function () {
oTable.fnAdjustColumnSizing();
} );
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bDeferRender": true,
"iDisplayLength": 10,
"bServerSide": true,
"sAjaxSource": "Test.asp",
"sScrollY": 400,
//"sScrollX": "500px",
"sDom": "frtiS",
"bDeferRender": true,
"bJQueryUI": true,
"fnServerData": fnDataTablesPipeline,
"sPaginationType": "full_numbers",
"sDom": 'T<"clear">lfrtip',
"oTableTools": {
//"sSwfPath": "extras/media/swf/copy_csv_xls_pdf.swf"
}

} );
} );

</script>
[/CODE]
Classic ASP Code : TEST.asp


[CODE]
<%
sEcho = Cint(Request("sEcho"))
iDisplayLength = Cint(Request("iDisplayLength"))
iDisplayStart = Cint(Request("iDisplayStart"))
sSearch = trim(UCASE(Request("sSearch")))
sessid = Session("EID")


strWhere = " WHERE COL1 LIKE '%" & sSearch & "%' OR "
strWhere = strWhere & " COL2 LIKE '%" & sSearch & "%' OR "
strWhere = strWhere & " COL3 LIKE '%" & sSearch & "%' OR "
'strWhere = strWhere & " COL4 LIKE '%" & sSearch & "%' OR "
'strWhere = strWhere & " COL5 LIKE '%" & sSearch & "%' OR "
strWhere = strWhere & " COL6 LIKE '%" & sSearch & "%'"

for k=0 to 3
if Request("bSortable_" & k)="true" then
order = order & Request("iSortCol_" & k) & " " & Request("sSortDir_" & k)
end if
next
order = Replace(order,"0",", COL1")
order = Replace(order,"1",", COL2")
order = Replace(order,"2",", COL3")
order = Replace(order,"3",", COL4")
'order = Replace(order,"4",", COL5")
'order = Replace(order,"4",", COL6")


if Len(order) <> 0 then
order = Right(order, Len(order)-1)
Else
End If

strOrderBy = " ORDER BY " & order

if isnull(trim(order)) or trim(order) = "" then
strOrderBy = " ORDER BY 1"
Else
End If

Set Session("objConn") = Server.CreateObject("ADODB.Connection")
strConnection = "Provider=MSDAORA;Data Source=PERS;User Id=ITMAN;Password=ITMAN;"
Session("objConn").open strConnection

SQL = "select COL1, COL2, , COL3, COL4, COL5,COL6 from PERSTBL " & strWhere & " and IS_DELETED <> 'Y' "& strOrderBy
Set rs = Session("objConn").Execute(SQL)

'Response.Write sql
'Response.Write date()
'Response.Write tstr

iTotalDisplayRecords = 0
if rs.eof = false then
do while not rs.eof
iTotalDisplayRecords = iTotalDisplayRecords + 1
rs.movenext
loop
rs.movefirst
end if

SQL2 = "SELECT count(*) FROM PERSTBL where IS_DELETED <> 'Y'"
Set rs2 = Session("objConn").Execute(SQL2)
iTotalRecords = rs2(0)
%>
{"sEcho": <%=sEcho%>, "iTotalRecords": <%=iTotalRecords%>, "iTotalDisplayRecords": <%=iTotalDisplayRecords%>, "aaData": [
<% i= 0
if rs.eof = false then
rs.move(iDisplayStart)
do while i < iDisplayLength and not rs.eof
tstr = Left(rs("COL5"),100)

if isnull(rs("DEP_ON_LIVE")) or rs("DEP_ON_LIVE") = "N" then
set_typ = "<font color=#FF0000> - (U)</font>"
Else
End If

if rs("DEP_ON_LIVE") = "Y" then
set_typ = "<font color=#FF0000> - (P)</font>"
set_typ1 = "<a href=Patch_Revert.asp?edit_val=" & rs("COL1") & "&rnum=" & rs("rowid") & ">REVERT</a> " & set_typ
Else
set_typ1 = "<a href=patch_add_to_live.asp?edit_val=" & rs("COL1") & "&rnum=" & rs("rowid") & ">TO LIVE</a> | <a href=Patch_Revert.asp?edit_val=" & rs("COL1") & "&rnum=" & rs("rowid") & ">REVERT</a> " & set_typ
End If

if rs("IS_REVERTED") = "Y" then
set_typ = "<font color=#FF0000> - (R)</font>"
set_typ1 = "<a href=patch_add_to_live.asp?edit_val=" & rs("COL1") & "&rnum=" & rs("rowid") & ">TO LIVE</a> | <a href=Patch_Revert.asp?edit_val=" & rs("COL1") & "&rnum=" & rs("rowid") & ">REVERT</a> " & set_typ
Else
End If
aaData = aaData + "['<a href=Edit_Patch.asp?edit_val=" & rs("COL1") & "&rnum=" & rs("rowid") &">" & rs("COL1") & "</a>','"& rs("COL3") &"','" & rs("COL4") & "','" & rs("COL2") & "','<a href=Edit_Patch.asp?edit_val=" & rs("COL1") & "&rnum=" & rs("rowid") &">" & tstr & "</a>','"& set_typ1 &"'],"
aaData = Replace(aaData,"'",chr(34))
rs.movenext
i=i+1
loop
aaData = Left(aaData,Len(aaData)-1)
else
aaData = ""
end if
response.write aaData & "] }"
%>
[/CODE]

post id in session not by $_GET in URL

$
0
0
When I click on a row in my table, it goes off to another page to draw info from a server processing script for further work.My problem is that the method I am using passes the unique id in the URL which leaves things wide open from a security point of view. How would I pass the row info in the script below to the next page in a session?

Thank's in advance

$(document).ready(function() {
   $('#tbl_purchase_invoices').dataTable( {
	            "aoColumnDefs": [
                                {
				"mData": null,
                "sDefaultContent": "Edit",
                "fnRender": function ( oObj ) {
                return '<a href="pay_invoice.php?var='+oObj.aData[1]+'">Pay invoice</a>';
                                },
                "aTargets": [ 9 ]
                                }
                                ],
				"bProcessing": true,
				"bServerSide": true, //$comp_id = $_SESSION['sess_company_id'];
				"sAjaxSource": "datatables_data/purchase_invoice_data.php",
					 "fnServerParams": function ( aoData ) {
				  aoData.push( { "name": "company_id", "value":"<?php echo $comp_id; ?>"} ); // <--- replace id with your id
	
				   }
					}
					  )
						});

</script>


Fix Vertical Scroll Bar

$
0
0
I am using sScrollY and my table has many columns. How can I fix the vertical scroll bar so that I do not have to scroll horizontally to the last column before having access to the vertical scroll bar?

Thank you
Viewing all 1816 articles
Browse latest View live