0

I built a plugin that I want to re-use in jqGrid.

Is it possible to attach a custom plugin to the edittype property of setColProp

techlead
  • 779
  • 7
  • 24
  • 44
  • Sorry, but I can't understand what you mean. Do you develop jQuery plugin or jqGrid Plugin? Could you better describe your problem on an example? Do you use [custom](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules#custom) editing type? Why you want use `setColProp` to change the value of `edittype` to `'custom'`? Do you want to choose the `edittype` between `'custom'` and other [predefined types](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:common_rules#edittype) dynamically? Where you see the problem? – Oleg Nov 28 '11 at 10:10
  • I wrote a plugin that I need to re-use with jqgrid. The plugin loops through the elements in JSON response and depending upon the number of elements, it either draws out an input field or a dropdown. Example: if the number of elements in json = 10, then a text field should display and if the number of elements in json > 10, then a dropdown should display. I already have this plugin and I want to re-use this plugin in jqgrid inline editing mode instead of writing a separate piece of code for this. – techlead Nov 28 '11 at 15:00
  • The starting point is how the plugin is implemented. You don't answer whether it's jQuery plugin or jqGrid plugin. Probably one will be not able to answer your question till to see any code from the plugin. – Oleg Nov 28 '11 at 15:21
  • It's a jquery plugin. I've been attaching the plugin as `$(this).pluginName({.. parameters .. })` – techlead Nov 28 '11 at 15:29
  • @Oleg: is my question clear now? – techlead Nov 28 '11 at 16:42
  • Absolutely not clear. I see no relation of all what you wrote to `edittype` property. I can only repeat that without looking in the code of plugin I will be not able to help you. – Oleg Nov 28 '11 at 17:38
  • @Oleg: it's just a plugin. u can actually take any plugin for that matter. I don't think it is necessary for you to look at the plugin code as it has got nothing to do with jqgrid. I was just asking a way to integrate the plugin with jqgrid in inline editing mode... something similar to a function call with jsonmap. Thanks anyways. – techlead Nov 28 '11 at 17:44
  • If you just say plugin it gives almost no information. For example it can be Drag&Drop plugin or jSrollPane plugin, some animate plugin, look at cycle plugin or jQuery UI tabs plugin. I can continue... To say plugin you say almost only that you wrote some JavaScript code which do something and use jQuery. There are no relation with inline editing or `edittype`. I know good jQuery UI Tabs plugin, but I don't understand how you can set attach to "to the edittype property of setColProp". What you wrote before like "it either draws out an input field or a dropdown" gives more questions as answers. – Oleg Nov 28 '11 at 22:57
  • @Oleg: my first comment speaks about the plugin's functionality. As mentioned in my comments multiple times, this plugin has nothing to do with jqgrid and I'm trying to find a way to integrate it with jqgrid in inline editing mode. – techlead Nov 28 '11 at 23:04
  • Sorry, but I really don't understand what the plugin do. You wrote that it do something with "input" and "dropdown" elements, but the description say nothing about **how to use plugin**. You wrote "I want to re-use this plugin in jqgrid inline editing mode", but I can't help you to re-use the plugin if I don't understand how to use it. For example the usage of Autocomplete or Datepicker plugin are relatively simple (if one don't think about details), but the usage of other plugins like raty (see [here](http://stackoverflow.com/a/4842450/315935)) is **much more** complex. Do you understand me? – Oleg Nov 28 '11 at 23:19
  • @Oleg: My 2nd comment specifies how I'm attaching/using the plugin and passing any parameters needed to the plugin. Forget about the plugin that I built. Please let me know if you know how to integrate Autocomplete plugin with jqgrid in inline editing mode. – techlead Nov 28 '11 at 23:25
  • @Oleg: Here's another one for you in case you have time - http://stackoverflow.com/questions/8303447/jqgrid-json-getting-wrong-value – techlead Nov 28 '11 at 23:29
  • 1
    You can just use `editoptions` having `dataInit` For example you can use `dataInit: function (elem) {$(elem).autocomplete({source: someUrl});}`. – Oleg Nov 28 '11 at 23:31
  • Now is too late in Germany. I will look your other question tomorrow. – Oleg Nov 28 '11 at 23:33

0 Answers0