Search
3647 results 411-420
Forum
- 1st Feb 2013Ignore empty cells when sorting by groupsI have a table with two groups of colums. Half left and half right. The rows at the left are related to the ones at the right so that one row in the left can be related to many rows at the right. I won't use any sorting options for the half right side of the table but I would like to add this options for the ones in the left side. The thing is that the number of rows in the left side still being the same as the rows in the right but some of them are empty. () in order to show the relation between the rows at the left side and the ones at the right side. Here an image of what I'm talking about: http://i.stack.imgur.com/ZNLOG.gif I have managed to order it by group: (by the second column) [code] var table = $('.tlmTable').dataTable(options).rowGrouping({ iGroupingColumnIndex: 1, sGroupingColumnSortDirection: "asc", iGroupingOrderByColumnIndex: 1, bHideGroupingColumn:false, bHideGroupingOrderByColumn:false, }); [/code] But now i have another problem. The empty rows are also sorted inside each group in a way I dont want. Each group should always have the not empty row at the top. If I have this table, for example: A - demo2 - related1 - related1 A - ______- related2 - related2 A - ______- related3 - related3 B - demo1- related1 - related1 B - ______- related2 - related2 B - ______- related3 - related3 I am grouping it by the first column (in this example). Ordering it by the 2nd column should result in this: (demo1 < demo2) B - demo1- related1 - related1 B - ______- related2 - related2 B - ______- related2 - related2 A - demo2 - related1 - related1 A - ______- related2 - related2 A - ______- related2 - related2 But currently, I have this kind of result: (as it order also the empty inside each group) B - ______- related3 - related3 B - ______- related2 - related2 B - demo1- related1 - related1 A - ______- related2 - related2 A - ______- related3 - related3 A - demo2 - related1 - related1 I have tried to solve it with a code i saw here: http://datatables.net/forums/discussion/4025/sorting-to-ignore-empty-cells/p1 But now it doesn't do anything when i try to sort the columsn i defined as "mystring". Only after sorting first by the right side columns and then doing it with the left side ones. In my case this is the code i'm using (if nothing is wrong): [code] jQuery.fn.dataTableExt.oSort['mystring-asc'] = function(x,y) { var retVal; x = $.trim(x); y = $.trim(y); if (x==y) retVal= 0; else if (x == "" || x == " ") retVal= 1; else if (y == "" || y == " ") retVal= -1; else if (x > y) retVal= 1; else retVal = -1; // <- this was missing in version 1 return retVal; } jQuery.fn.dataTableExt.oSort['mystring-desc'] = function(y,x) { var retVal; x = $.trim(x); y = $.trim(y); if (x==y) retVal= 0; else if (x == "" || x == " ") retVal= -1; else if (y == "" || y == " ") retVal= 1; else if (x > y) retVal= 1; else retVal = -1; // <- this was missing in version 1 return retVal; } var options = { "aoColumns": [ null, null, { "sType" : "mystring" }, { "sType" : "mystring" }, { "sType" : "mystring" }, { "sType" : "mystring" }, { "sType" : "mystring" }, null, null, null, null, null, null, null, null, null, null, null, null ], oLanguage: { "oPaginate": { "sNext": ">", "sPrevious": "<", } } }; [/code] Am I doing anything wrong? Is it possible what I'm looking for?
- 3rd Jan 2013Input fields in table cells wiped out on loading JSON stringI have defined a HTML table in JSP and associated it with DataTables plugin (DataTables 1.9.4 with jQuery 1.8.1). I have three columns in my table and the first column contains checkbox. When I load data into table using aaData it wipes out the checkboxes even though I give mData as null for the first column. Please let me know where I am going wrong. [code] var oTable = $("#table-id").dataTable({ bJQueryUI: true, bPaginate: true, sPaginationType: "full_numbers", bFilter: false, bInfo: false, aoColumnDefs: [ { "bSortable": false, "aTargets": [ 0 ] }, { "bSortable": false, "aTargets": [ 4 ] } ], // bProcessing: true, // sAjaxSource: '', aaData : [{"col2":"1000","col3":"text here"}, {"col2":"1000","col3":"text here"}], aoColumns: [ { "mData": null }, { "mData": "col2" }, { "mData": "col3" } ] }); [/code] Thanks!
- 4th Dec 2012Formatting Data CellsIf I have a column on my table that I would like to format as currency, what would be the best way to do that? I looked into mData but I could use some clarification on its usage.
- 15th Oct 2012Table cells with child elements messing up sorting?This seems strange: http://jsfiddle.net/y5d3b/ Some of the TD elements have empty DIV elements and it seems to be breaking the sorting. Is this expected behavior? Is there a way around it?
- 18th Jul 2012Change formatting of cells matching regexI'm looking for a way to apply a class to a cell in a table column, if the cell matches a regular expression. I swear I saw this somewhere in the help, but for the life of me, I cannot find it. I can do this within the json data, by wrapping the text returned in font tags, but I'd rather not have formatting inside the json data. item The Status column can have a value of 'Pending', 'Running' or 'Complete'. I'd like to make the text colour Red, Green and Blue respectively, by using various pre-defined classes: .ht_red, .ht_green, .ht_blue [code] $('#t_opencases').dataTable( { "sDom": 'T<"clear">lfrtip', "oTableTools": { "sSwfPath": "../swf/copy_csv_xls_pdf.swf", "aButtons": [ { "sExtends": "copy", "sButtonText": "Copy to Clipboard", "bFooter": false }, { "sExtends": "xls", "sButtonText": "Export to Excel", "bFooter": false }, { "sExtends": "pdf", "sButtonText": "Export to PDF", "bFooter": false } ] }, "sAjaxSource": "cases.php", "sPaginationType": "full_numbers", "iDisplayLength": 25, "aLengthMenu": [ [25, 50, 100, -1], ["25", "50", "100", "All"] ], "aoColumns": [ { "sName": "id", "sTitle": "ID", "sWidth": "5%" }, { "sName": "status","sTitle": "Status" }, { "sName": "priority","sTitle": "Priority" }, { "sName": "assignee","sTitle": "Assignee", "sWidth": "12%" }, { "sName": "created", "sTitle": "Create Date", "sWidth": "16%" }, { "sName": "owner", "sTitle": "Owner", "sWidth": "12%" } ], }) .columnFilter({ aoColumns: [ null, null, { type: "select" }, { type: "select" }, { type: "select" }, { type: "select" }, { type: "Date" }, { type: "select" }, { type: "select" } ] }) }); [/code]
- 1st Apr 2012select multiple column cells and updateHi Everyone, I was wondering whether it is possible to do a multiple select of values from a column, and then update them all at once... for example: A table has three columns and 4 rows and I want to change the contents of column 2 row 1 and 3 and change them to the same date or whatever. Another feature I need is the ability to dynamically add a column. thanks in advance
- 18th Feb 2012Button in CellsHi How can I integrate button in a cell?
- 18th Feb 2012Feed cells DataTablesHello all in a DataTables, I should record a progress status of a particular object on each line, I'll explain. The record consists of an object id, a description and 4 columns that represent the assignment, the start, a middle and an end. The feed must be represented by an image that a user can move only on the record. Can you give me some help? thanks
- 16th Feb 2012DataTables Editable on AjaxUpdate, Can you update N Cells?I have currently a table like this. Indicator Type Value1 Value2 Value3 ValueN AllValues Something 1 1 1 1 1 4 When i Update Value1, Row1, to 2, in the database i update AllValues following some formula(Type=1 means Sum fo All Values, Type=2 means AllValues=Last Value, and so on) I was wondering if i can return this calculation to DataTables. Or I can calculate this on Jquery? I dont know wich is the best way..
- 23rd Sep 2011How to sort not by cells content?I have a table with times and dates that stores in DB in seconds, but it shows in table in this formats: 1 day 16 hours 20 minutes 18 seconds Aug 20th 2011, at 6:17:28 pm And of corse DataTables sort this column wrong. How can I make it sort them by DB values, not by readable formats?