Reputation: 18178
I wish to add a button in my jqgrid edit form next to one of the input fields. When I click the button I want to put a certain value in the input field. I can handle the code of inserting the text that I want in the field. The part I don't know is how to make the custom button appear there next to the text field. See my sketch, for the button. Then i just need the ability to have this:
$('#my_new_button').click(...
Does anyone know how I can get this custom button in the edit form?
Thanks!
Upvotes: 0
Views: 1872
Reputation: 1
//Insert a link after #member_id into edit form $.extend($.jgrid.edit, { recreateForm: true, width:700, viewPagerButtons:false, beforeShowForm: function ($form) { $('CHECK ID') .click(function() { alert("ID IS OK!"); }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left") .insertAfter("#member_id"); } }); //Insert a link after #member_id into add form $.extend($.jgrid.new, { recreateForm: true, width:700, viewPagerButtons:false, beforeShowForm: function ($form) { $('CHECK ID') .click(function() { alert("ID IS OK!"); }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left") .insertAfter("#member_id"); } });
Upvotes: 0
Reputation: 1758
yes i think its possible, see in this answer guy first cloned the submit button and then changed the properties of submit button and then adding it to after the element you want, in your case, it should be after textBox of total(get the Id) and then writing the functionality about what you want to do on click...
and with this answer also you might get some help, in this he's first changing the submit button but then adding a new custom button also...you can take that feature from it..
How to add custom buttons to JqGrid add/edit forms?
Upvotes: 2