volosoft / jtable

A JQuery plugin to create AJAX based CRUD tables.
http://www.jtable.org
1.1k stars 505 forks source link

Button into the grid with custom action #299

Open javibishop opened 11 years ago

javibishop commented 11 years ago

Hello, can i put a new button or override the action on update action and make that show a div with some field to complete? I have a parent child relation and the childs need to be selected from anotehr grid with checkbox. Another solution that i thought was to open the editor with another jtable inside into the editor pop up, can i do that? Sorry for my english. javier

FSIvan commented 11 years ago

You need something like the example below which opens up a child table inside the row.

                 Information: {
                    title: 'Info',
                    width: '5%',
                    sorting: false,
                    edit: true,
                    create: true,
                    type:'textarea',
                    display: function (customerData) {
                        var $img = $('<img src="content/images/document_properties.png" title="View and edit information" />');
                        $img.click(function () {
                            $('#CustomersTableContainer').jtable('openChildTable',
                                    $img.closest('tr'),
                                    {
                                        title: customerData.record.Name + ' - Information',
                                        actions: {
                                            listAction: 'ajax/customer_info_actions.php?action=list&searchterm=' + customerData.record.CustomerNumber,
                                        },
                                        fields: {
                                            CustomerNumber: {
                                                title: 'Number',
                                                key: true,
                                                create: false,
                                                edit: false,
                                                list: false
                                            },
                                            Information: {
                                            title:'information',
                                                create: false,
                                                edit: true,
                                                list: true,
                                                type:'textarea'
                                            },

                                        }
                                    }, function (data) { //opened handler
                                        data.childTable.jtable('load');
                                    });
                        });
                        return $img;
                    }
                },  
'''''
javibishop commented 11 years ago

i will test it!. Thanks. javier

javibishop commented 11 years ago

I tested but i need something like the image bellow or when i click on : $img.click(function () { here i need to open a new windows to other controler and view, or a new view like the "Materia Prima", this is the child objects of the relationships. Its a one to many relationship. I atach anoter images where i put my idea.(prototype) prototype

I hope you understand me. Javier Sin t tulo4

klunker commented 11 years ago

Hmm, I use a autocomplite function from jquery-ui ( look at JavaScript code http://feo-klunker.blogspot.com/2013/02/autocomplete-c-autocomplete-with.html) also if "searchstring" not found I add it to database, for example city list, streets.