I want to trigger a function after the user search something on my navGrid.
I've found the event loadComplete but that doesn't match with my expectations because I also reload my grid programmatically. Then maybe there is something link to the click... if someone has an idea.
Thanks.
There are exist onSearch callback (and jqGridFilterSearch jQuery event). It trigger reloadGrid which finish with loadComplete (and jqGridAfterLoadComplete jQuery event). You can set some custom option of jqGrid inside of onSearch callback (for example, $(this).jqGrid("getGridParam").searchingStarted = true;) and to test its value inside of loadComplete. At the end of loadComplete you should always reset the value of the custom option. In the way you can distinguish reloading of the grid started from Searching Dialog from other reloading.
Related
We're using the date input component as part of some parameterization on a page. So, as soon as the onChange event fires we want to go fetch some more data.
The problem is that the onChange fires too often as a user is typing. If I type just "Nov" that's setting a valid date of Nov-01-YYYY, and so the onChange event fires. I believe I would like to fire the onChange only when a full date has been entered, or the enter key is pressed, though I'm open to other ideas.
DateInput does not currently provide such a feature. Sounds like you're requesting an onConfirm handler. GitHub is the place to request features.
Is there a way to remove all the rows in the jqGrid, without calling jqgrid's loadComplete method.
You can use clearGridData. From the jqGrid documentation:
Clears the currently loaded data from grid. If the clearfooter parameter is set to true, the method clears the data placed on the footer row.
A quick inspection of the code seems to confirm that this method does not call loadComplete, although it will call gridComplete.
I am using cell editing in jqgrid and for that, i am using many different jqgrid events, as mentioned below ...
1) beforeSelectRow, 2)beforeEditCell, 3)afterEditCell, 4)onCellSelect, 5)ondblClickRow, etc...
Now, when i doubleClick on any of the row, the beforeselectRow code gets executed first.. which i want to prevent... but how to do that ??
Some example code is as below :-
ondblClickRow: function(id,irow,icol,e)
{
........
},
beforeSelectRow : function(rowid, e)
{
if(rowid==lastSelected)
{
$sampleDialog.dialog('open');
}
}
Different web browsers process the double-click event in a little different ways. So in general you can't prevent 'click' event before 'dblclick'. The callback beforeSelectRow will be called inside of click enevt handler defined inside of jqGrid code. In jQuery documentation of dblclick event handler you can read the following (see here):
It is inadvisable to bind handlers to both the click and dblclick
events for the same element. The sequence of events triggered varies
from browser to browser, with some receiving two click events before
the dblclick and others only one. Double-click sensitivity (maximum
time between clicks that is detected as a double click) can vary by
operating system and browser, and is often user-configurable.
What you currently do is just not recommended way to binding both 'click' and 'dblclick' handles.
You don't describe the original problem which you has which is probably somewhere inside of ondblClickRow callback implementation. The only solution will be to examine reorganization of the program to have no collisions between the actions inside of beforeSelectRow and ondblClickRow callbacks.
I want to remove the pointer cursor from all non-sortable column headers in all of my jqGrids as in this answer. I currently do so for some of them in the gridComplete event.
Is there a way to set a default event, or grab all of the jqGrids on a page, and append that function the gridComplete event? I could not find anything in the options.
If you don't change the value of sortable property of the columns dynamically you don't need to do this on every grid refreshing. The columns will be created once at the creating of jqGrid. So you can just place the code which fixes the cursor on non-sortable columns after the grid definition. So you don't need to use gridComplete or any other callback.
By the way I use the word "callback" instead of "event" used in jqGrid documentation because you can define really one callback per grid. So you can't easy define somewhere in common place gridComplete with common actions and use another gridComplete in the grid definition. So if you define gridComplete as default option $.jgrid.defaults (see here) it will default till you not overwrite it in the definition of some jqGrid. To fix the problem I posted detailed suggestion how to extend functionality of jqGrid to support real events. Later I posted pull request with the changes. After long discussion the functionality is included in the code of jqGrid. So the next version jqGrid (which should be published in a short time) will do have support events additionally to callbacks.
I have been following this example, http://www.ok-soft-gmbh.com/jqGrid/DependendSelects2.htm, as it is just what I need. I have got it working but it doesnt work when scrolling through records. If you bring up the form and scroll from a UK record to a US record, the list doesnt change. The onChange event only fires when the user selects from the select drop down.
Is there a way around this?
Thanks for your help.
James
My old demo uses 'change' event handler defined in the dataEvents property of the editoptions. In the dataEvents array one can define other event handlers.
You need just bind keyup to the column exactly like it's described in the answer. In the body of the event handler you can do the same actions as in the body of the 'change' event handler (you can place the code in a function and call it from the both handlers). In the way you should be able to solve the problem.
UPDATED: I updated the old answer and another one which was origin for the demo which you used. The new demo support the navigation buttons (the buttons to edit the 'next' or the 'previous' row) in the editing form.