I tought about the problem which I described here many time, but I forgot to write the suggestion as the feature request.
The problem is following. The current implementation of jqGrid call dataInit and dataEvents directly after creating the corresponding control and before the control are placed on the HTML page as the child of the corresponding cell. One has many problems as the consequence of the method. As the result one have to place frequently the code of dataInit inside of setTimeout which is not nice.
I can describe the problem on the following example. One have for example textarea control (edittype: 'textarea') and uses the inline editing. In the case jqGrid do the following:
- inside of inline editing module it calls $.jgrid.createEl (see the line)
- inside of grid.common.js module it creates textarea control with document.createElement("textarea") (see the line)
- after that inside of grid.common.js module it makes some initializations of the control (see the lines) inclusive calling of internal setAttributes function.
- then one calls internal bindEv function which calls dataInit and dataEvents (see the line)
- after that some additional attributes will be set on the control (see the line for example)
- Then (inside of inline editing module) it adds "editable" class to the cell (see the line)
- inside of inline editing it places the textarea control on the HTML page with $(this).append(elc); (see the line)
I find that it would be very good to make internal bindEv function accessible per $.jgrid.bindEv and move the call of bindEv from $.jgrid.createEl to the corresponding editing module. In the above example one could call $.jgrid.bindEv at the end of all described above steps.
After such changes the code of many implementations of dataInit could be run without usage of tricks like setTimeout.
Alternatively one could consider to call $.jgrid.bindEv event more later after all controls in the editing row will be placed on the page.
This a good recommendation actaully. Will do it later this week.
I have made the changes in GitHub. I need to perform moree deep tests, but for now it is ok.
Most Users Ever Online: 215
Currently Browsing this Page:
Guest Posters: 447
Newest Members: drussell, sbarrow, vijay16_babu, vijay_babu, jayaraj, priyankmodi.20691
Moderators: tony (7531), Rumen[Trirand] (81)
Administrators: admin (61)