Open unle70 opened 11 months ago
Hello Udi,
Thanks for the recommendation.
I think we can pass the grid element (this) and the options (which contain everything you need).
I will refer this issue when these are added.
Thank you Tony
You can test the new addition as described into the commit.
Hi Tony,
Well, for having a "full solution", there are 3 places that need to be handled:
The select as function can be used in editoptions and searchoptions. This is true since the select as function is defined in createEl function which is called every time when input select element is created including in searching methods.
Not sure that the logic you describe should be applied, instead that historically in certain places it is available. I think that every module (formatter, edit, search) should have his own options and not use the option from the other when it is not defined.
Hi Tony,
When I tried to use the "function" type "value" for the "select" type in formatting, it didn't call the function. I looked at the code and didn't see any checking for type "function" there (I think it's in "jquery.fmatter.js" line 234 and on). I only see checking whether it is a String or an Object. Am I wrong about this location?
As for the different options, I understand your point. It's just that I saw the code mentioned above, and saw that it DOES have this fallback from formatoptions to editoptions (line #242). So that is why I was proposing the same line of thinking for searchoptions. But it's OK if you keep them separate.
Hi Tony,
When using the "select" formatter, the documentation is giving a quick hint that the editoptions.value (and formatoptions.value) can actually be a function. I see that indeed you can define a function there, for dynamically setting the select options, but there's a problem. This function is getting NO input parameters and "this" is pointing to some internal jqGrid object (not a DOM element).
I think it would be very nice if this function could have some useful parameters, maybe the same as for the custom formatter, and "this" should point to the grid. It would make things easier when implementing dynamic values.