{"id":15018070,"url":"https://github.com/luisvonmuller/rdatatables","last_synced_at":"2025-10-23T15:30:18.153Z","repository":{"id":57658666,"uuid":"283942235","full_name":"luisvonmuller/rdatatables","owner":"luisvonmuller","description":"This is the \"backend\" implementation for the datatables AJAX api on rust-lang.","archived":false,"fork":false,"pushed_at":"2021-01-25T14:57:18.000Z","size":28,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-30T19:07:32.141Z","etag":null,"topics":["datatables","datatables-server-side-scripting","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luisvonmuller.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-31T04:30:51.000Z","updated_at":"2021-09-20T21:32:26.000Z","dependencies_parsed_at":"2022-09-16T10:41:12.229Z","dependency_job_id":null,"html_url":"https://github.com/luisvonmuller/rdatatables","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisvonmuller%2Frdatatables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisvonmuller%2Frdatatables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisvonmuller%2Frdatatables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisvonmuller%2Frdatatables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luisvonmuller","download_url":"https://codeload.github.com/luisvonmuller/rdatatables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237843742,"owners_count":19375195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["datatables","datatables-server-side-scripting","rust","rust-lang"],"created_at":"2024-09-24T19:51:23.986Z","updated_at":"2025-10-23T15:30:17.858Z","avatar_url":"https://github.com/luisvonmuller.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rdatatables\nThis is the \"backend\" implementation for the datatables AJAX api on rust-lang.\n\n# Follow this on how to use: \n* Add rdatatables = \"0.0.1\" on your crate;\n* use rdatatables::*; (You'll need all of it anyways);\n* First you will need a listener function for your \"ajax\"-POST. \ne.g:\n\n```rust\n/* Your datat structers */\nuse crate::models::rdatatables::{\n    ClerksViewListing, ClerksViewListingClerkInfo, ClerksViewListingStatusClerk,\n};\n\n#[post(\"/list\", data = \"\u003cquery\u003e\")]\npub fn list(\n    _adminitrative: AdminUser,\n    query: LenientForm\u003cDataTableQuery\u003e,\n) -\u003e Json\u003c\n    OutcomeData\u003c(\n        ClerksViewListing,\n        ClerksViewListingStatusClerk,\n        ClerksViewListingClerkInfo,\n    )\u003e,\n\u003e {\n    Json(datatables_query::\u003c(\n        ClerksViewListing,\n        ClerksViewListingStatusClerk,\n        ClerksViewListingClerkInfo,\n    )\u003e(\n        Tables {\n            origin: (\"sysuser\", \"user_id\"), /* From */\n            fields: vec![\n                \"clerk_info.clerk_image\",\n                \"sysuser.user_name\",\n                \"sysuser.user_uni\",\n                \"sysuser.user_balance\",\n                \"status_clerk.is_available\",\n                \"sysuser.user_status\",\n                \"sysuser.user_id\",\n            ], /* Fields to seek for */\n            join_targets: Some(vec![ /* If you desire to not do a Join at all, just give a None here */\n                /* (join_type, (target, target_key), (origin, origin_key) */\n                (\"inner\", (\"clerk_info\", \"user_id\"), (\"sysuser\", \"user_id\")),\n                (\n                    \"inner\",\n                    (\"status_clerk\", \"clerk_id\"),\n                    (\"sysuser\", \"user_id\"),\n                ),\n            ]),\n            datatables_post_query: query.into_inner(), /* Incoming Query parses to the desired struct. */\n            query: None,                               /* Our builded query holder */\n        },\n        crate::establish_connection(),\n    ))\n}\n```\n\n* Then your struct (that must be QuerybleByName and also Identifiable), like this\n```rust \n\n/* ClerksViewListing (Implements joins) */\n#[derive(Debug, QueryableByName, Serialize, Clone)]\n#[table_name = \"sysuser\"]\npub struct ClerksViewListing {\n    pub user_name: String,\n    pub user_uni: Option\u003cString\u003e,\n    pub user_balance: f64,\n    pub user_id: i32,\n}\n\n#[derive(Debug, QueryableByName, Serialize, Clone)]\n#[table_name = \"status_clerk\"]\npub struct ClerksViewListingStatusClerk {\n    pub is_available: Option\u003ci32\u003e,\n}\n\n\n#[derive(Debug, QueryableByName, Serialize, Clone)]\n#[table_name = \"clerk_info\"]\npub struct ClerksViewListingClerkInfo {\n    pub clerk_image: Option\u003cString\u003e,\n}\n\n\n```\n* Your front-end association with datatable must be something like this, do not forget about the \"post\" and \"columns\",\n```js\n$('#clientsTable').DataTable({\n\t\t\t\"serverSide\": true,\n\t\t\t\"ordering\": true,\n\t\t\t\"info\": true,\n\t\t\t\"ajax\":\n\t\t\t{\n\t\t\t\turl: \"/admin/clerk/list\",\n\t\t\t\ttype: \"POST\"\n\t\t\t},\n\t\t\t\"columns\": [\n\t\t\t\t{ \"data\": \"1.clerk_image\" },\n\t\t\t\t{ \"data\": \"0.user_name\" }, \n\t\t\t\t{ \"data\": \"0.user_uni\" },\n\t\t\t\t{ \"data\": \"0.user_balance\" },\n\t\t\t\t{ \"data\": \"2.is_available\" },\n\t\t\t\t{ \"data\": \"0.user_status\" },\n\t\t\t\t{ \"data\": \"0.user_id\" }, /* Stands for user_id */\n\t\t\t]\n});\n\n```\n\nHave fun. \nfollow me on twitter: @luisvonmuller \n## I'm open to oportunities ;) luis@vonmuller.com.br\n\n###  this crate maybe be open to SQL injections via the \"search\" field on the front-end datatables. This will be fixed as soon as possible. - If your able to fix it for us, please, do!\n\nWhats missing? \n* Regex searching\n* combinative column searching\n* Fixing performance issues over the iterator of column parser (By now the lib is parsing columns by an exaustive sequencial IF statement. Must be fixed.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisvonmuller%2Frdatatables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluisvonmuller%2Frdatatables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisvonmuller%2Frdatatables/lists"}