Yara
Yara

Reputation: 4565

How to re init context menu?

The jquery context menu works fine if I assign it first time. But when I re-assign it second time context menu works with previous function.

Code with first time:

$("#26134_x16Fwj2VUp8Sa74").contextMenu("rowContMenu_26134_x16Fwj2VUp8Sa74", 
{bindings: 
        { 'itemQuickEdit_26134_x16Fwj2VUp8Sa74' : function(t) 
                { 
                showQuickEditForm(26134,'x16Fwj2VUp8Sa74'); 
                }
        }
}); 

Code with second time:

$("#26134_x16Fwj2VUp8Sa74").contextMenu("rowContMenu_26134_x16Fwj2VUp8Sa74", 
{bindings: 
        { 'itemQuickEdit_26134_x16Fwj2VUp8Sa74' : function(t) 
                { 
                **showFullEditForm**(26134,'x16Fwj2VUp8Sa74'); 
                }
        }
});

So I think it have to be function like re-init. ($.removeData etc...)

Upvotes: 0

Views: 274

Answers (1)

Val
Val

Reputation: 17522

Have you tried ?

$("#26134_x16Fwj2VUp8Sa74").unbind().contextMenu("rowContMenu_26134_x16Fwj2VUp8Sa74", 
{bindings: 
        { 'itemQuickEdit_26134_x16Fwj2VUp8Sa74' : function(t) 
                { 
                **showFullEditForm**(26134,'x16Fwj2VUp8Sa74'); 
                }
        }
});

Upvotes: 1

Related Questions