Anatoliy
Anatoliy

Reputation: 321

How to add custom function in onClick-event jqGrid-mode editGridRow?

Firstly I used this call jQuery('#grid').jqGrid('editRow',id,true,pickdates);, it worked fine with UI Datepicker integration, but editRow is implemented for inline editing, but I prefer modal dialog, so I switched to editGridRow, now I can't find the way to call my custom function (pickdates) in onClick-event. My current call is:

jQuery('#grid').jqGrid('editGridRow',id,{closeOnEscape:true,width:400,savekey:[true,13]});

Thanks

Upvotes: 0

Views: 5339

Answers (2)

Oleg
Oleg

Reputation: 221997

It is better to use dataInit property of the editoptions instead of the usage of oneditfunc parameter (pickdates in your case) of the editRow method.

editoptions: {
    dataInit : function (elem) {
        $(elem).datepicker();
    }
}

The setting is common for inline editing, form editing and cell editing. Practically the same setting exist for the searching configuration.

Upvotes: 1

Sarpdoruk Tahmaz
Sarpdoruk Tahmaz

Reputation: 1448

You can use event.preventDefault(); to prevent methods calling the default function.

$('#grid').click(function() {
    event.preventDefault();

    MyFunction();  // Here you can call your own function instead of the default one.

});

I'm not sure if this is what you want but you can modify the code a little and make it work.

Upvotes: 0

Related Questions