Get and Edit data for individual users
Get and Edit data for individual users
I am using latest version of data-table editor.
In my project, each authenticated user should see the relevant data in the table for him.
Also the editing privileges are given accordingly.
I would like to know best method that can be used for these functions. I am thinking to incorporate this check in 'REST interface'(as in example) to verify the user and privileges . Or shall I use 'DOM sourced table' (as in example)( to get only the relevant data for given user). please advice me.
In my project, each authenticated user should see the relevant data in the table for him.
Also the editing privileges are given accordingly.
I would like to know best method that can be used for these functions. I am thinking to incorporate this check in 'REST interface'(as in example) to verify the user and privileges . Or shall I use 'DOM sourced table' (as in example)( to get only the relevant data for given user). please advice me.
This discussion has been closed.
Replies
Allan
Using REST interface I get the initial table data using the code
[code]"sAjaxSource": "php/rest/get.php"[/code]
But how to restrict the data to be fetched for that particular user ?
suppose, For a particular user need to display only the data related to 'Internet Explorer' as browser.
What is the extra code i have to add for that in the editor example ?
[code]
include( "browsers.php" );
$editor
->process($_POST)
->json();
[/code]
Use the `where` method to add a WHERE condition to the SQL: http://editor.datatables.net/docs/current/php/class-DataTables.Editor.html#_where
Allan
Very quick reply and it works well for me. But please see the REST interface example the DELETE not working well. Even though it removes the data from database it does not get deleted from table (remove.php could not complete, fail to refresh table itself) .
Appears to be working okay for me. This example here: http://editor.datatables.net/release/DataTables/extras/Editor/examples/REST.html ?
Allan
in that example, on pressing delete button action does not complete, even though it deletes the data from the database. The dialog window does not closes or refreshes the dom table.
Allan
I've tried, Safari, Firefox, IE and Chrome and all work no problem for me.
by the way I have one more doubt in the REST interface method. To load the table I am calling [code]"sAjaxSource": "php/rest/get.php"[/code]
and in this php file I am using[code] ->where( '$ table column name', '$ user given data' )[/code]
How to pass these parameters along with this ajax request
[code]
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "more_data", "value": "my_value" } );
}
[/code]
I am able to process this values in the ajax source file and retrieve the data accordingly from database using WHERE condition. Thank you Allan.