Add Custom button at end of fields in Jquery - jTable Create/Update mode like submit button

Harry picture Harry · Sep 8, 2013 · Viewed 9.6k times · Source

At jquery- jTable we can have some fields and actions . I need Other button [possible at end of page] near by Jquery JTable button("Submit" button) that after on Click , run another function . so this is my code :

    $('#RequestSubmitDiv').jtable({
            title: 'newRec',
            paging: false,
            sorting: false,
            selecting:false; 
            selectingCheckBoxes:false,
            selectOnRowClick:false,
            jqueryuitheme:true,
            formCreated:function(event,data){
                 data.form.validationEngine();
            },
            formSubmitting:function(event,data){
               ...
               ...
            },
            formClode: function(d,e){...} ,                

            actions: {
                createAction: '/Adminsec/ManageAssets.aspx/CreateOrUpdate',
           //---not need below
                //listAction: '/Adminsec/ManageAssets.aspx/List',
                //updateAction: '/Adminsec/ManageAssets.aspx/CreateOrUpdate',
                //deleteAction: '/Adminsec/ManageAssets.aspx/Deletes'

  //-!!---Other Button and Action Need ---!!
                CustomAction:{
                  title:'RefreshNew',
                  sorting:false,
                  create:false,
                  edit:false ,
                  list:false ,
                  display:function(data){
                    return '<input type='button' id='MyBtn' onclick='Call_Mehod();>';                              
                   }

                 }
            },

            fields: {
              ID {title:'pk',type:'textarea'} , 
              RequestNO{type:'textarea'},
              description{type:'textarea'}
            }
        });

How can i add some button to Jquery- Jtable and call function ? these buttons don't repeat at rows or column , i mean it should be One instance after fields scope.

Answer

Alper picture Alper · Oct 11, 2013

Maybe I misunderstood but if you want to add a button on each row, you can use display property of the field. I created a dummy field and added the display property. Somthing like this:

...
Other: {
    title: 'Other',
    display: function (data) {
       return '<b>test</b>';
    },
    create: false,
    edit: false

}
...

However, if you wanted to add a general feature (i.e. single button for the table) , you can take a look at the toolbar property.