Ignited DataTables |
[eluser]cipmang[/eluser]
[quote author="ηυмвєяσηє" date="1310656958"]controller : Code: function datatabless() and go to main/showpage.. datatabless is your ajax listener and its output will be array.[/quote] thanks a lot ηυмвєяσηє, yeah,..... i like this share... i'll share it to with other people...
[eluser]meddiecap[/eluser]
Hi, Wow, very sweet class! I'm playing with it a bit trying to get searching per column working. I'm getting this error: Call to a member function where() on a non-object [..] on line 236, when using Code: "aoSearchCols": [ It concerns this line: Code: $this->ar->where($this->select[$mColArray[$i]].' like', '%'.$this->ci->input->post('sSearch_' . $i).'%'); I'm using the current version of Datatables.php Hope you can help! Thanks
[eluser]ηυмвєяσηє[/eluser]
Hi, Thanks for that. Now it fixed on github. Im afraid, regular expressions on filtering are not supported by the library at the moment. Regards, Yusuf
[eluser]pmsfo[/eluser]
Just Added Group By Fuction to datatables, it works for me. Code: protected $groupbys = array(); Now you can use $this->datatables->group_by('job.jobid,job.name,job.starttime,job.endtime, job.jobfiles,job.jobbytes,job.jobstatus,job.level, jobmedia.mediaid,media.volumename'); Signature ______________________________________________ www.newitperson.com www.newitperson.com/reportula
[eluser]pmsfo[/eluser]
How Can I do this, change the value of column to image by if clause example: Code: if ($row['jobstatus'] == "T" ){ How i can do this with the library ?
[eluser]ηυмвєяσηє[/eluser]
Hi, Code: $this->load->helper("Datatables"); // create datatables_helper.php in helpers folder // add these functions to datatables_helper.php Code: function getjobstatus ($jobstatus) { About 'GROUP BY', I thought this before, However It is better to use the code below for some reasons. [quote author="ηυмвєяσηє" date="1309445845"]you should use 'GROUP BY' in subqueries. For Example : Code: $this->load->library("Datatables"); its not a very good example but i think u got the idea ^^ Regards, Yusuf[/quote]
[eluser]lordoffriends[/eluser]
How to override the Query string parameter in editable datagrid ?The default query string is generated by the datagrid(i.e adding an id parameter which has the value of the first column cell of the datatable).When i click on the specific row,and click on the delete button,the delete url is called as given in the code.This url is initialized in the code.What i want to ask is ,how do i override the url at runtime(i.e adding my row data specific query string in the url) ???? This is the code i am using... ------------------------------------------------------------------------ $(document).ready( function () { oTable=$('#example').dataTable({ "bProcessing": true, "sAjaxSource": "http://localhost/questions/Test/listener", "fnInitComplete": function (){ $(oTable.fnGetNodes()).click(function (){ var aPos = oTable.fnGetPosition( this ); var aData = oTable.fnGetData( aPos[0] ); }); }, aoColumns: [ { "bVisible": false} , null, null, null, null ] } ).makeEditable({ sUpdateURL: "UpdateData.php", sAddURL: "AddData.php", sAddHttpMethod: "GET", sDeleteURL: "http://localhost/questions/Test/DeleteData", sDeleteHttpMethod: "GET", }); } ); ------------------------------------------------------------------- Waiting for reply.
[eluser]cryogenix[/eluser]
although your question is datatables specific, we're kind enough to answer you take note of the submitdata parameter here: http://www.datatables.net/examples/api/editable.html with that in mind, you can do some editing like this: Code: 'submitdata':
[eluser]pmsfo[/eluser]
For the images what i did was this Code: $this->datatables->edit_column('job.level', '<img src='.base_url().'>', 'job.level'); and change the name of file. For example i only have 2 types of jobs levels "I" and "F" so i change the filename from incBackup.png for I.png and F.png. i think in this case its better than creating a database helper. But it's nice to know that is possible to create helpers and using functions. thank you very much for you r reply
[eluser]lordoffriends[/eluser]
This is the code... var oTable; var aData; var row; $(document).ready(function() { $('#example tbody tr').live('click', function (event) { $(oTable.fnSettings().aoData).each(function (){ $(this.nTr).removeClass('row_selected'); }); $(event.target[removed]).addClass('row_selected'); aData = oTable.fnGetData(this); // get datarow row = $(this).closest("tr").get(0); }); /* Add a click handler for the delete row */ $('#delete').click( function() { $.ajax({ type: "GET", url: "<?php echo base_url(); ?>Test/DeleteData", data: "id="+aData[0], success: function(msg){ //oTable.fnDeleteRow(aData); var anSelected = fnGetSelected( oTable ); oTable.fnDeleteRow( anSelected[0] ); oTable.fnDeleteRow(oTable.fnGetPosition(row)); } }); } ); /* Init the table */ oTable = $('#example').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "<?php echo base_url(); ?>Test/Listener", "sPaginationType": "full_numbers", "iDisplayLength": 1, "bSortClasses": false, "aoColumns": [ { "bVisible": false} , null, null ] } ); } ); /* Get the rows which are currently selected */ function fnGetSelected( oTableLocal ) { var aReturn = new Array(); var aTrs = oTableLocal.fnGetNodes(); for ( var i=0 ; i<aTrs.length ; i++ ) { if ( $(aTrs[i]).hasClass('row_selected') ) { aReturn.push( aTrs[i] ); } } return aReturn; } What is happening :- The server side data gets loaded when page is called for the first time. The server side data gets deleted on clicking delete link.But the Datatable doesnt refresh after deleting a row on server.The usual "processing" message comes after deletion on server.It stays there.The UI row stays there highlighted with message "Processing" in the middle of the page What i have observed is :- 1)The response of Ajax source after the delete url is called is this :- {"sEcho":1,"iTotalRecords":1,"iTotalDisplayRecords":1,"aaData":[["11","PD101-DH1234","adsasd"]],"sColumns":"PartId,PartNumber,PartDescription"} 2)After using firebug,i observed no abnormalities.Both the delete and get source requests are executed perfectly with response OK. 3)I am using FireFox 4.1 4)I am using DataTables 1.8.1 build. Now Question :- What do i change in the above code so that the datatable UI row gets deleted and datatable refreshes to bring the remaining rows ??? |
Welcome Guest, Not a member yet? Register Sign In |