0

I cannot call jqgrid using the . operator as given in the examples:

jQuery("#grid_id").editGridRow( "new", options );

I get the following error:

jQuery("#grid_id").editGridRow is not a function

Instead I always have to make a call in the following way:

jQuery("#grid_id").jqGrid("editGridRow", "new", options );

I don't have any problems with the latter approach - I am curious why the former does not work for me, when most examples and tutorials using the former approach

Thanks

2 Answers 2

2

Probably you used the following code

jQuery.jgrid.no_legacy_api = true;

somewhere in you program either directly or indirectly (see documentation). The code prohibit the usage of "old style" API.

By the way if you prefer the usage of the "old style" API because of IntelliSense support in the Visual Studio you can use the "new style" API in a little other form:

jQuery("#grid_id").jqGrid.editGridRow ("new", options);

instead of

jQuery("#grid_id").jqGrid ("editGridRow", "new", options);

In the case there are no conflicts with another jQuery Plug-Ins which described Nick Craver, but the IntelliSense will continue work:

alt text

and

alt text

Sign up to request clarification or add additional context in comments.

1 Comment

yup - that is absolutely correct! thanks a ton - wish i could vote this up +10
0

This is just the way the plugin designers chose to do it. The alternative is to have all of their methods on $.fn (present on the prototype, so on every jQuery object), which has a few issues:

  • Now there are lots of methods defined on every object
  • Potential for conflict, what if they wanted an already taken jQuery method, or one jQuery adds later?

The list of methods jqGrid has isn't short, so this is a way for them to keep it under control and compartmentalized. Also, this isn't unique to jqGrid...for example the jQuery UI theming it accepts, all of the widgets in that library follow the same convention.

1 Comment

but did they change this recently? because the documentation say this is valid: jQuery("#grid_id").jqGrid('method', parameter1,...parameterN ); -- trirand.com/jqgridwiki/doku.php?id=wiki:methods

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.