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

[eluser]kunal doake[/eluser]
Thanks for ur reply but i dont understand.
can u explain or post a code to feeding result to datatables ajax request

thanks again for ur urgent reply.
#82

[eluser]cryogenix[/eluser]
read my explanation on the first post. specially on the part where i talk about pointing the sAjaxSource. i believe the instructions i gave there are sufficient enough. the post may seem long but only is because of the sample codes i've posted. please take some time to do initiative reading and you'll be all set.
#83

[eluser]ηυмвєяσηє[/eluser]
[removed]

it will be newer version of ignited datatables including join table feature.

custom columns and custom filtering may come.

Regards,
Yusuf
#84

[eluser]cryogenix[/eluser]
great posting yusuf. i looked at your code and i've got a question and some suggestion:

-> will the simple call:

Code:
$data['result'] = $this->datatables->generate($table, $columns, $index);

still work? or rather, what if the user doesn't want to make joins? based on your code, the user will always end up calling generate with 5 parameters and not with 3 anymore for the previous "non-join" call.

i've created an overloading mechanism starting at line 45 to make the generate call flexible so that it can be passed either with only the simple 3 arguments or 1 arg for sql (still working on this) and 5 for your additional columns and joins.

therefore you will end up with something like:
Code:
case 1:
  $result = $this->__call('generate_from_sql', $args);
  break;
case 3:
  $result = $this->__call('generate_from_tci', $args);
  break;
case 5:
  $result = $this->__call('generate_from_join', $args);
  break;

now this may be repetitive and of course will need refactoring to minimize code repetition but this gives the user the flexibility i am talking about. hope you get my point? i'm kinda sick today so i may be much of a blur to express my thoughts. do send me an email if you need help. i do love collaborative work and your help is much appreciated.

EDIT:
what i am telling is that if we could add your code for the missing joins feature, we would need it refactored in order to still enable the existing library to maintain the functions it currently has.
#85

[eluser]ηυмвєяσηє[/eluser]
ty for ur suggestions.

i am working on it now.

by the way. i think the way i add the tables seems complicated ^^ (arrays in arrays)

this way is more readable
Code:
// usage: $jointables["table1"]["columns"] = array("column1","column2","column3");
//        $jointables["table1"]["opt"] = "$table.id = table1.id";
// another table :
//        $jointables["table2"]["columns"] = array("column1","column2");
//        $jointables["table2"]["opt"] = "$table.id = table2.id";

// example
      $jointables["sections"]["columns"] = array("sectionname");
      $jointables["sections"]["opt"] = "pages.cat_id = sections.id";
      $jointables["users"]["columns"] = array("username");
      $jointables["users"]["opt"] = "pages.add_by = users.id";

i have removed custom columns thing for now. and seperated functions as u said. still working on it.

Regards,
Yusuf
#86

[eluser]ηυмвєяσηє[/eluser]
[removed]

it will be newer version of ignited datatables including join table feature.

custom columns and custom filtering may come.

Regards,
Yusuf
#87

[eluser]cLin[/eluser]
Is there an example of what a controller file would look like for this?
#88

[eluser]ηυмвєяσηє[/eluser]
there is a new version of the library that supports table joins, custom columns, custom filtering. also bSearchable:false and column ordering has been fixed.

download https://github.com/IgnitedDatatables/Ignited-Datatables

examples https://github.com/IgnitedDatatables/Ign...ables/wiki
#89

[eluser]dobbler[/eluser]
Thanks for the update, it's really rocking now!

However, I'm getting this error in firebug when I use a custom filter:

Code:
<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  Invalid argument supplied for foreach()</p>
<p>Filename: libraries/Datatables.php</p>
<p>Line Number: 298</p>

</div>{"sEcho":1,"iTotalRecords":"1","iTotalDisplayRecords":"1","aaData":[["4","2011-04-30","19:45:00","Test Gig","Dublin"]],"sColumns":"gigs.id,gigs.gdate,gigs.gtime,gigs.venue,gigs.city"}

This is my code:

Code:
$table = "gigs";
$columns = array("id", "gdate", "gtime", "venue", "city");
$index = "id";
$options["custom_filter"] = "gigs.gdate >= '" . date('Y-m-d') . "'";
$this->load->library("Datatables");
$data['result'] = $this->datatables->generate($table, $columns, $index, $options);

So, as you can see it's returning the correct record but it's not displaying because of the invalid foreach() error.

It works fine without the custom filter.

Not sure why this is happening, any ideas?

Many Thanks,

Rob.

EDIT: I got it going by wrapping the code on lines 298-300 in an if statement:

Code:
if (count($jointables) != 1) {
      foreach($jointables as $jointable_key => $jointable)
        foreach($jointable['columns'] as $jcolumn_key => $jcolumn_val)
          $tabledotcolumn[] = $jointable_key . '.' . $jcolumn_val;
   }

But I'm no expert at php so I'm not sure what other implications this may have but it seems to be working fine.. Maybe there's a more elegant solution?
#90

[eluser]cryogenix[/eluser]
let's wait for yusuf to respond to your issue... anyways, i've also updated the first post with the git stuffs... hoping for your feedbacks... =)




Theme © iAndrew 2016 - Forum software by © MyBB