embedded if else statement
Ok, I am lost. Well... confused.
I am trying to get a website menu system to initiate jqGrid correctly depending on the presence of IDs.
I have the menu item working correctly here (if the grid has previously been built):
- $("#threeeightcal").click( function() {
- var muniitonType = $('#searchResults').jqGrid('getGridParam','xmlReader:row');
- if (munitionType = 'bullet') {
- $("#searchResults").jqGrid('setGridParam',{url:"weaponLib/sa-bullet38cal.xml"}).trigger("reloadGrid");
- };
- });
All good so far.
Now I need to modify it so that it tests for the presense of id "gbox_searchResults". gbox will always get built if jqGrid has been previously initiated. But my script is always going to the else statement. What simple thing am I doing wrong?? I have verified that when website first appears and user has control of menu system that the id gbox_searchResults is not even in the DOM. So my return should be a false.
Broke code:
- $("#threeeightcal").click( function() {
- var gridBuilt = $('#gbox_searchResults');
- var muniitonType = $('#searchResults').jqGrid('getGridParam','xmlReader:row');
- if (!(gridBuilt)) alert("your a dummy");
- // completely re-init jqGrid
- else alert("good to go");
- // reload grid with new static xml file
- });
It is not the job you get handed, but what you have done with it in the end that people remember.