Suguna Ss
Suguna Ss

Reputation: 57

How to remove cancel button from jqgrid add form?

jqgrid add dialog have two buttons(submit and cancel). A message will be displayed when i click the cancel button. That message box have 3 buttons(yes, no and cancel). Now i want to remove the cancel button. any possibilities........?

Sorry for my bad english. Thank you.

sample coding for jqgrid

<sjg:grid id="gridtable"
caption="Customer List"
dataType="json"
href="%{remoteurl}"
pager="true"
gridModel="customerList"
rowNum="10"
autowidth="true"
editurl="%{editurl}"
editinline="false"
navigator="true"
navigatorAdd="true"
navigatorAddOptions="{
        viewPagerButtons: false,
        recreateForm: true,
        checkOnUpdate: true,
        closeAfterAdd: true,
        height: 275,
        width: 600,
        draggable: false,
        resizable: false
    }"
navigatorDelete="true"
navigatorEdit="true"
navigatorRefresh="true"
navigatorSearch="true"
navigatorEditOptions="{
        viewPagerButtons: false,
        recreateForm: true,
        checkOnUpdate: true,
        closeAfterEdit: true,
        height: 275,
        width: 600,
        draggable: false,
        resizeable: false
    }"
navigatorDeleteOptions="{ checkOnUpdate: true}"
navigatorViewOptions="{
        viewPagerButtons: false,
        recreateForm: true,
        checkOnUpdate: true,
        height: 225,
        width: 620,
        draggable: false,
        resizeable: false
    }"
navigatorSearchOptions="{
        sopt:['eq','ne','lt','gt','in','ni','cn','nc'],
        closeAfterSearch: true
    }"
navigatorView="true"
rownumbers="true"
rowList="10,20,30"
viewrecords="true"              

>

Thank you so much.

Here i am specifing that cancel button enter image description here

how to remove this cancel button?

I need only yes and no buttons.

Upvotes: 2

Views: 1022

Answers (2)

leerickx
leerickx

Reputation: 84

I think you can apply it to each form add, edit, etc.

hide button cancel

onInitializeForm: function($form) {
$form.parent().find('#cData').hide();
}

or if you want hide button submit

beforeShowForm: function ($form) {
$form.parent().find('#sData').hide();
},

Upvotes: 0

Nirav Liya
Nirav Liya

Reputation: 21

Using grid API how it can be possible i dont know but,using jquery you can hide this button in following way : $("#gridtable #cNew).css({'display':'none'});

'#cNew' is id of that button or you can get id of Cancle button by right click on that button and select inspect element in mozila webbrowser or use firebug to get id of that button and then replace that id with #cNew.

Upvotes: 2

Related Questions