Popup Selection Ajax 1.7.25 Semantic UI theme
On Button ajax call, define form to pick parameters. Click to publish and view a popup window.
HIDE CODE
<?php // Get an instance of Xcrud $xcrud = Xcrud::get_instance(); // Set the table to 'base_fields' $xcrud->table('base_fields'); // Define columns to display: 'text', 'date', 'bool' $xcrud->columns('text,date,bool'); // Create custom actions 'publish' and 'unpublish', which are defined in functions.php $xcrud->create_action('publish', 'publish_action'); $xcrud->create_action('unpublish', 'unpublish_action'); // Define a button 'unpublished' with specific attributes and conditions $xcrud->button( '#', 'unpublished', 'icon-close glyphicon glyphicon-remove', 'xcrud-action', array( // Set data attributes for the button 'data-task' => 'action', 'data-action' => 'publish', 'data-primary' => '{id}' ), array( // Set condition when the button should be shown (when 'bool' column is not equal to '1') 'bool', '!=', '1' ) ); // Prepare a JSON string representing a form definition $form = urlencode('[{"title":"Status","id":"status", "type":"select","options":"<option value=1>Done</option><option value=2>Non Done</option>"},{"title":"Description","id":"description","type":"textarea"}]'); // Define a button 'published' with specific attributes and conditions $xcrud->button( '#', 'published', 'icon-checkmark glyphicon glyphicon-ok', 'xcrud-action', array( // Set data attributes for the button 'data-task' => 'action', 'data-action' => 'unpublish', 'data-form' => 'true', 'data-form-id' => '', // ID of HTML form (if applicable) 'data-form-json' => $form, // JSON string of form definition 'data-form-confirm-logic' => 'status==1', // Logic to confirm processing (process completes when 'status' equals '1') 'data-form-confirm-logic-failure-message' => 'Could not process', // Message displayed if confirmation logic fails 'data-primary' => '{id}' // Placeholder for primary key value ), array( // Set condition when the button should be shown (when 'bool' column equals '1') 'bool', '=', '1' ) ); // Render the Xcrud instance echo $xcrud->render(); ?>
Base Fields
# | Text | Date | Bool | |
---|---|---|---|---|
1 | Test test | Yes | published View Edit Remove | |
2 | Test | 28.09.2013 | Yes | published View Edit Remove |
3 | Test test test | 30.11.2032 | No | unpublished View Edit Remove |
4 | Text | Yes | published View Edit Remove | |
5 | ttt | 01.01.1970 | Yes | published View Edit Remove |
6 | No | unpublished View Edit Remove | ||
7 | No | unpublished View Edit Remove | ||
8 | No | unpublished View Edit Remove | ||
9 | No | unpublished View Edit Remove | ||
10 | No | unpublished View Edit Remove |