Welcome Guest, Not a member yet? Register   Sign In
Ignited DataTables

[eluser]php6[/eluser]
Greetings, anyone can help me I'm using the csv library and I can not do this query with the methods afforded me by this library

example

Code:
Select *
from table1
Union
select *
from table2

[eluser]ninjayan[/eluser]
Hello it's me again. My ignited datatables are now working and I added a column for delete action.

controller
Code:
public function get_transaction_types()
{
  $this->load->library('datatables');
  $this->datatables
     ->select('name, days', FALSE)
     ->from('transaction_types')
     ->add_column("Actions",
      "<form id='edit_form' method='post' action='settings/edit_transaction_type/$1' class='left'>
      <input type='hidden' value='$1' id='trans_type' name='trans_type' readonly />
      <button class='settings-action-btn' title='Update'>
      <img src='assets/images/icons/edit.png' alt='Update' />
      </button>
      &lt;/form&gt;
      &lt;form id='delete_transaction_type_form' method='post' action='settings/delete_transaction_type/$1' method='post' class='right'&gt;
      &lt;input type='hidden' value='$1' id='delete_trans_type' name='delete_trans_type' readonly /&gt;
      <button class='settings-action-btn' title='Delete'>
      <img src='assets/images/icons/delete.png' alt='Delete' />
      </button>
      &lt;/form&gt;",
      "name");
  echo $this->datatables->generate();
}

view
Code:
<div id="transaction_type_table_container">
        <table id="transaction_type_table" class="tight">
         <thead>
          <tr>
           <th class="text-center">Transaction Type</th>
           <th class="width160 text-center">Number of days</th>
           <th class="width70 text-center">Action</th>
          </tr>
         </thead>
         <tbody>
          <tr>
           <td colspan="7" class="dataTables_empty">Loading data from server</td>
          </tr>
         </tbody>
        </table>
       </div>

My problem is I want to have a popup box (confimation box) when I click the delete button in action column. I try to add jquery on click to the button='settings-action-btn' to alert but nothing happens. Any suggestion?

[eluser]ninjayan[/eluser]
Anybody can help me? Please?

[eluser]Unknown[/eluser]
DataTables needs to have an actual tutorial video... it's way to complicated. Not necessarily your CI Library, but the entire jQuery plugin. For beginners like me, it's just impossible to get started. You can look at all the examples as I have done and still not get a single piece of it. I still get a 400 error when trying to use the server-side implementation, and believe the problem may lie in my initialization. I don't understand what aoColumns are, or what needs to be in there, and what doesn't.

Is there anything similar to DataTables but easier to use?

[eluser]ηυмвєяσηє[/eluser]
http://vimeo.com/25273887

i've made a video about how to use it some time ago.. but it has no sound. give it a try ^^

[eluser]ninjayan[/eluser]
Hello. My ignited datatables code get the name and days and $1 is the name.
Code:
"&lt;form id='edit_form' method='post' action='settings/edit_transaction_type/$1' class='left'&gt;
      &lt;input type='hidden' value='$1' id='trans_type' name='trans_type' readonly /&gt;

I want also to store the days on another hidden field. How would that be possible? thanks!

[eluser]cryogenix[/eluser]
[quote author="ninjayan" date="1351669761"]Hello it's me again. My ignited datatables are now working and I added a column for delete action.

controller
Code:
public function get_transaction_types()
{
  $this->load->library('datatables');
  $this->datatables
     ->select('name, days', FALSE)
     ->from('transaction_types')
     ->add_column("Actions",
      "&lt;form id='edit_form' method='post' action='settings/edit_transaction_type/$1' class='left'&gt;
      &lt;input type='hidden' value='$1' id='trans_type' name='trans_type' readonly /&gt;
      <button class='settings-action-btn' title='Update'>
      <img src='assets/images/icons/edit.png' alt='Update' />
      </button>
      &lt;/form&gt;
      &lt;form id='delete_transaction_type_form' method='post' action='settings/delete_transaction_type/$1' method='post' class='right'&gt;
      &lt;input type='hidden' value='$1' id='delete_trans_type' name='delete_trans_type' readonly /&gt;
      <button class='settings-action-btn' title='Delete'>
      <img src='assets/images/icons/delete.png' alt='Delete' />
      </button>
      &lt;/form&gt;",
      "name");
  echo $this->datatables->generate();
}

view
Code:
<div id="transaction_type_table_container">
        <table id="transaction_type_table" class="tight">
         <thead>
          <tr>
           <th class="text-center">Transaction Type</th>
           <th class="width160 text-center">Number of days</th>
           <th class="width70 text-center">Action</th>
          </tr>
         </thead>
         <tbody>
          <tr>
           <td colspan="7" class="dataTables_empty">Loading data from server</td>
          </tr>
         </tbody>
        </table>
       </div>

My problem is I want to have a popup box (confimation box) when I click the delete button in action column. I try to add jquery on click to the button='settings-action-btn' to alert but nothing happens. Any suggestion?[/quote]

try attaching an onclick event to your button:

Code:
onclick='if(confirm("Are you sure?")) document.forms["delete_transaction_type_form"].submit(); return false;'

[eluser]Unknown[/eluser]
Code:
function view_user()
{
  $status=1;
  $this->datatables
    ->select("id,name,email,username,type,date_added")
    ->from('ap_users')
    ->unset_column('id')
    ->edit_column('type', '$1', 'callback_str_replace(1, ,type)')
    ->edit_column('date_added', '$1', 'callback_datechange(d-m-Y H:i|date_added)')
    ->add_column('edit', '<a href="profiles/edit/$1">edit</a>&nbsp;|&nbsp;<a href="profiles/edit/$1">delete</a>', 'id');
  echo $this->datatables->generate();            
  
}
The callback function not working it print full function in column.

javascript call

$('table.all').dataTable({
  "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": config.base_url + "main/view_user",
  'fnServerData': function(sSource, aoData, fnCallback)
            {
              $.ajax
              ({
                'dataType': 'json',
                'type'    : 'POST',
                'url'     : sSource,
                'data'    : aoData,
                'success' : fnCallback
              });
            }
  
    });

Also can anyone help me where to write the callback function

[eluser]ninjayan[/eluser]
there's a problem on the code?
please see the attached screenshot..thank you.. Confusedmirk:

[eluser]Unknown[/eluser]
Hello,

i have 2 table. "category" and "post". category has 2 field : categoryId and categoryName. post has 3 field: postId, title, categoryId

now i want to show datatable categoryName and number of post according to this category.

how can i show this.

Regards,
Rejuan




Theme © iAndrew 2016 - Forum software by © MyBB