{"id":20060462,"url":"https://github.com/codeigniterpower/codeigniter-datatables","last_synced_at":"2026-06-22T16:31:53.777Z","repository":{"id":185036184,"uuid":"670756483","full_name":"codeigniterpower/codeigniter-datatables","owner":"codeigniterpower","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-25T19:08:40.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-29T17:40:54.803Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeigniterpower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-25T19:05:20.000Z","updated_at":"2023-07-25T19:08:44.000Z","dependencies_parsed_at":"2023-07-31T14:07:18.646Z","dependency_job_id":null,"html_url":"https://github.com/codeigniterpower/codeigniter-datatables","commit_stats":null,"previous_names":["codeigniterpower/codeigniter-datatables"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codeigniterpower/codeigniter-datatables","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeigniterpower%2Fcodeigniter-datatables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeigniterpower%2Fcodeigniter-datatables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeigniterpower%2Fcodeigniter-datatables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeigniterpower%2Fcodeigniter-datatables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeigniterpower","download_url":"https://codeload.github.com/codeigniterpower/codeigniter-datatables/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeigniterpower%2Fcodeigniter-datatables/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34657892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T13:14:40.030Z","updated_at":"2026-06-22T16:31:53.753Z","avatar_url":"https://github.com/codeigniterpower.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ci-datatables\nLibrary for server side  datatables implementation on codeigniter. CI Datatables is a wrapper class/library based on the native Datatables server-side implementation by Allan Jardine\nfound at http://datatables.net/examples/data_sources/server_side.html for CodeIgniter\n\n## Features\n1. Easy to use. Generates json using only a few lines of code.\n2. Support for table joins (left, right, outer, inner, left outer, right outer).\n3. Able to define custom columns, and filters.\n4. Editable custom variables with callback function support.\n5. Supports generation of tables using non utf-8 charsets.\n\n## Requirements\njQuery 1.5+   \nDataTables 1.10+   \nCodeIgniter 3.*\n\n## Installation\nTo install the library, copy the libraries/datatables.php file into your application/libraries folder.\n\n\n## Function Reference\n\n### $this-\u003esetdb($database = 'default')\nSets the name of the database configuration, if need another apart of default, \nThe name of the database its optional.\n\nNote: you can use method chaining for more compact syntax. \n### $this-\u003edatatables-\u003eselect($columns);\nSets which columns to fetch from the specified table.  \n\n```\n$this-\u003edatatables-\u003eselect('id, name, age, gender');\n```\n*This function also accepts an optional second parameter.\n### $this-\u003edatatables-\u003efrom($table);\nSets the primary table in which data will be fetched from.\n\n```\n$this-\u003edatatables-\u003efrom('mytable');\n```\n### $this-\u003edatatables-\u003ejoin($table, $fk, [$type]);\nSets join statement variables. If you want DataTables to include data from another table, you can define an a table along with its columns and foreign key relationship.\n\n```\n$this-\u003edatatables-\u003ejoin('mystates', 'mycountries.state_id = mystates.id', 'left');\n```\n*This function also accepts an optional third parameter for specifying the join type.  \n### $this-\u003edatatables-\u003ewhere();\nSets filtering variable to facilitate custom filters.\nFor additional filtering conditions, the WHERE clause works like CodeIgniter's. So you can do statements like:  \n\n```\n$this-\u003edatatables-\u003ewhere('id', '5');\n```\n\n```\n$this-\u003edatatables-\u003ewhere('age \u003e', '25');\n```\n\n```\n$this-\u003edatatables-\u003ewhere('position != \"admin\"');\n```\n\n```\n$array = array('name' =\u003e 'J%', 'status' =\u003e 'Single');\n$this-\u003edatatables-\u003ewhere($array);\n```\n\n### $this-\u003edatatables-\u003efilter();\nSets filtering variable to facilitate custom filters. Adds \"(filtered from xxx total entries)\" to datatables. Same usage with 'where()' method. \n### $this-\u003edatatables-\u003eadd_column($column, $content, [$match_replacement]);\nSets additional column variables to facilitate custom columns. You can also make your own custom column definitions via the following syntax:\n*match_replacement is optional only needed if you have $1 to $n matches in your content pattern  \n\n```\n$this-\u003edatatables-\u003eadd_column('edit', '\u003ca href=\"profiles/edit/$1\"\u003eEDIT\u003c/a\u003e', 'id');\n```\n### $this-\u003edatatables-\u003eedit_column($column, $content, $match_replacement);\nSets additional column variables for editing columns. You can also make your own custom column definitions via the following syntax:\n*match_replacement is needed in order to replace $1 to $n matches in your content pattern  \n\n```\n$this-\u003edatatables-\u003eedit_column('username', '\u003ca href=\"profiles/edit/$1\"\u003e$2\u003c/a\u003e', 'id, username');\n```\n### $this-\u003edatatables-\u003eunset_column($column);    \n### $this-\u003edatatables-\u003egenerate([$output], [$charset]);\nBuilds all the necessary query segments and performs the main query based on results set from chained statements.  \n*optional parameter output (default is json) can be set to 'raw' to return a non-paginated array of the aaData and sColumns  \n*optional parameter charset (default is UTF-8) is used when working with non utf-8 characters for json outputs (may decrease performance and be unstable)\n\n```\n$this-\u003edatatables-\u003egenerate();\n```\n\n```\n$this-\u003edatatables-\u003egenerate('json', 'ISO-8859-1');\n```\n\n```\n$results = $this-\u003edatatables-\u003egenerate('raw');\n$data['aaData'] = $results['aaData'];\n$data['sColumns'] = $results['sColumns'];\n$this-\u003eload-\u003eview('downloads/csv', $data);\n```\n\n## Method Chaining\n\nMethod chaining allows you to simplify your syntax by connecting multiple functions. Consider this example:  \n```\nfunction list_all()\n{\n  $this-\u003edatatables\n    -\u003eselect('id, name, age, gender')\n    -\u003efrom('tbl_profile')\n    -\u003ejoin('tbl_local', 'tbl_profile.local_id = tbl_local.id')\n    -\u003eselect('country')\n    -\u003ejoin('tbl_states', 'tbl_profile.state_id = tbl_states.id')\n    -\u003eselect('state')\n    -\u003eadd_column('view', '\u003ca href=\"' . base_url() . 'admin/profiles/view/$1\"\u003e\u003cimg src=\"' . base_url() . 'assets/images/admin/vcard.png\" alt=\"View\" title=\"View\" /\u003e\u003c/a\u003e', 'id')\n    -\u003eadd_column('edit', '\u003ca href=\"' . base_url() . 'admin/profiles/edit/$1\"\u003e\u003cimg src=\"' . base_url() . 'assets/images/admin/vcard_edit.png\" alt=\"Edit\" title=\"Edit\" /\u003e\u003c/a\u003e', 'id')\n    -\u003eadd_column('delete', '\u003ca href=\"' . base_url() . 'admin/profiles/delete/$1\"\u003e\u003cimg src=\"' . base_url() . 'assets/images/admin/vcard_delete.png\" alt=\"Delete\" title=\"Delete\" /\u003e\u003c/a\u003e', 'id');\n\n  $data['result'] = $this-\u003edatatables-\u003egenerate();\n  $this-\u003eload-\u003eview('ajax', $data);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeigniterpower%2Fcodeigniter-datatables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeigniterpower%2Fcodeigniter-datatables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeigniterpower%2Fcodeigniter-datatables/lists"}