spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Jtable ajax post not working


I had the same problem. Try adding this before the actions component in your table properties:

ajaxSettings: {
        type: 'POST', 
        data: {'VariableName': 'VariableValue'},
        url: './PersonActions.php'
        },

This occurs as the action 'list' does not POST any data through AJAX methods to your PersonActions.php. You have to do it manually.

For the other actions such as 'update' and 'delete' you don't need to make any additional changes, just use $_POST['Fieldname'] as shown in the JTable example code.

ALSO: I would recommend installing Firebug. It's really useful for viewing POST data and provides an additional tool for debugging.

EDIT #1 For master/child with PHP: If you want to add a child table, add the following code as an additional field in your master table. I have named the field 'ChildTableButton'.

           fields: {
                ChildTableButton: {
                        title: '',
                        width: '3%',
                        sorting: false,
                        edit: false,
                        create: false,
                        display: function
(ChildData) {
                            //Image that will open
child table
                            var $img = $('<img
src="./img/more.png"/>');
                            //Open child table
when user clicks the image
                            $img.click(function ()
{
                               
$('#PeopleTableContainer').jtable('openChildTable',
                                       
$img.closest('tr'),
                                        {
                                            title:
'Title',
                                           
actions: {
                                               
listAction: './tableactions.php?action=listchild',
                                              
updateAction:'./tableactions.php?action=updatechild',
                                               
deleteAction:
'./tableactions.php?action=deletechild'
                                                },
                                           
fields: {
                                               
Field1: {
                                                  
 title: 'Field 1 child table',
                                                  
 key: true,
                                                  
 create: false,
                                                  
 edit: false,
                                                  
 width: '50%'
                                                },
                                               
Field2: {
                                                  
 title: 'Field 2 child table',
                                                  
 width: '50%'
                                                }
                                            }
                                        },
function (data) { //opened handler
                                           
data.childTable.jtable('load');
                                        });
                            });
                            //Return image to show
on the person row
                            return $img;
                        }
                    },

You can then deal with PHP side by checking if action='listchild' etc, in the same way as your master table.

Hope this helps!


Categories : Javascript

Related to : Jtable ajax post not working
Set XML values in jTable
You'll need two things for this: A suitable XML parser. A custom table model, illustrated here. Depending on the chosen parser, you can either Construct a Java data structure, e.g. List<Entity>, that can be accessed in the TableModel. Access the document object model directly to meet the TableModel contract for getValueAt(), getRowCount(), etc. Addendum: Based on your edit, While y

Categories : Java
Pagination in JTable with row sorting
You can create a list with 10 items in wich you put your data from your big list, and create your table with the small list, and when your click on pagination buttons you load new 10 items from the big list to the small one.

Categories : Java
Can't update cells from JTable
Depending on what you are trying to do, you can use... JTable#setValueAt(Object, int, int) or TableModel#setValueAt(Object, int, int) to modify the row/column values of existing cells. Just beware, that the model and view might have different indices based on the current sort order and column positions. You can use DefaultTableModel#addRow to add new rows and You can use DefaultTableModel#remov

Categories : Java
Usage of Jtextarea in JTable
Create a Color object and invoke the setBackground(Color) method on your JTextArea, after checking if it has focus using the hasFocus(). For example: JTextArea area = new JTextArea(); Color c = Color.CYAN; if(area.hasFocus()) { area.setBackground(c); } Don't forget to save the original color of the (accessible by calling area.getBackground()

Categories : Java
Add record CSS not rendering Jtable
I think you may have missed referencing the jquery-ui.css file. The Edit/Create jtable modals use this css. Mine resides here: You may have to change the relative url in this css for icons. Hope it helps.

Categories : CSS
Recently Add
How to get selected text with JavaScript?
Non Modal Alert Messages in java script, activated by a button
How to Count [Combined] line length of multiple files?
Is there any javascript event fired when the on-screen keyboard on mobile safari or chrome opens?
Datatables sort by time ago
Internet Explorer getClientRects absolute positioned elements
How can I transform a CamanJS Filter into a KineticJS Filter?
AngularJS : index not updating after removing array item(s) by index
Slick slideshow in ember.js template
Recursive function with defer
Unable to find module mongodb in simple node.js app
Why does function return false after checking only one value in loop
Detect if the mouse is over an element
Placing and rotating svg elements along a path with Snap.svg
YouTube Asynchronous function
Cordova App: Stop JavaScript from running when App is closed
how to define a variable in an javascript ifstatement
display dd on click using jquery
jQuery Timer Countdown within Session
setInterval on click event to run for 10 seconds
Are syntax errors raised in JavaScript during Tokenizing or Parsing?
Can i perform form based http authentication for my TP-Link Wireless Router(IP: 192.168.0.1)
Blocked frame in reCapcha
Updated property not recognized by $watch
Template Missing error on update only
nodejs object declaration and immediate shorthand if statement crashes the app
Hide / show dynamically generated table columns with right / left animation
Convert UTC Date to Local Date in JavaScript
Position DOM elements without CSS
modifying mergesort to count inversions in JavaScript
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.