Nevermind…. solved with a custom global variable inEdit setting it in beforeInitData event then checking it in focusout event…. thanks anyway 🙂
I thought to use options.mode but seems it doesn’t work in dataEvents… is there a way to know if I am in edit or add mode when I fire a dataEvent?….
Nevermind…. I solved with:
1 |
$('<a href="#" rel="nofollow"><span class="ui-icon ui-icon-document"></span></a>').click(function() { alert("THIS IS OK!"); }).addClass("fm-button ui-state-default ui-corner-all fm-button-icon-left edit_button").insertAfter("#document_field"); |
If someone would have same scenario….. Thanks anyway…
Cheers!
Nevermind…. I solved by myself… thanks anyway 🙂
Hi again Will and all!
I think I encountered probably a bug on jqGrid but I am not sure…I wrote this code to refresh grid after submit the formedit:
ondblClickRow: function(rowid) {
jQuery(this).jqGrid(‘editGridRow’,
rowid,
{
editCaption: “Update”,
recreateForm:true,
dataheight: 180,
height: 270,
width: 350,
top: 40,
left: 170,
onclickSubmit : function (options, postdata) {
if( confirm(‘Update this record (Y/N)?’) ) {
//var rowid = postdata[this.id];
console.log( JSON.stringify(postdata) );
return {
// myParam: $(this).jqGrid(“getCell”, rowid, “URL”)
// test : “bla bla”
returndata : JSON.stringify( postdata )
//returndata : postdata
};
}
},
errorTextFormat: function (data) {
return ‘Error: ‘ + data.responseText
},
closeOnEscape: true,
closeAfterEdit: true,
afterSubmit : function() { $(“#grd-points_registry”).jqGrid(‘setGridParam’,{datatype:’json’}).trigger(‘reloadGrid’); }
//reloadAfterSubmit: false,
//aftersavefunc : function() { setTimeout( function() { $(“#grd-points_registry”).trigger(“reloadGrid”); }, 10); }
}
);
}
since I found searching on the web about .trigger(‘reloadGrid’) to force reloading after edit/add but the editform won’t close after triggered the reloadGrid thing and in debug on Chrome I see this:
jquery.jqGrid.min.js?ver=5.8.3:652 Uncaught TypeError: Cannot read properties of undefined (reading ‘0’)
at Object.complete (jquery.jqGrid.min.js?ver=5.8.3:652:172)
at fire (jquery.js?ver=3.6.0:3500:31)
at Object.fireWith (jquery.js?ver=3.6.0:3630:7)
at done (jquery.js?ver=3.6.0:9811:21)
at XMLHttpRequest.<anonymous> (jquery.js?ver=3.6.0:10057:9)
but all fields are numbers in this case …. same thing occurs also on edit and add inside navgrid pager…. any idea?
Thanks! Cheers!
Luigino
Hello again Will !!
Since I found that $_POST[‘oper’] to know which operation I am doing…. how’s called when passing the data?…
I tried with echoing $_POST[‘data’], $_POST[‘posdata’]Â , $_POST[‘editData’] ,$_POST[‘postdata’] but seems no one of them is the object with data passed to the php server because it returns “Notice: Undefined index: posdata in ….”
Thanks!
Cheers!
Luigino
Already found…. jqgrid passes $_POST[‘oper’] which distinguish between add , edit and delete so I can play with it! Thanks anyway! 🙂
Cheers!
Hello Will!
Thank you for the suggest code about scrollTop(0)…. I was trying to do something like that but it didn’t worked till I figured I had to remove “required: true” out because only after a lot of search it would exclude custom_func thing… So now it scrolls up at the top! 🙂
And since I am here I would ask you a little thing:
Using “url: ” would call for loading data, “editurl: ” would call for edit on update.
Since I have also add button in pager I tried to use afterSubmit: function(response, postdata) to call an ajax passing postdata but checking on debug I see it calls first the editurl and I suspect it passes postdata to that editurl so in ajax call it’s empty…. I tried also to comment the editurl thing to fire only the afterSubmit but it returned an error “no url settled” in the form…. maybe is there a way to distinguish edit and add using the same editurl option?…
Thank you !
Cheers!
Hello Will!
Thank you for your answer… In fact I saw there’s that red box at the top but if the edit form has lot of fields where I have to scroll the form down then I wont see the red notice… I tried to find a solution like to scroll the form up if the red notice appears but I haven’t seen any docs about it so I was thinking about the dialog message at least I can see the alert immediately…. hope I was clear about explanation of my scenario…. 🙂
Is there maybe a way to scroll the form up if the red alert notice appear?…
Thanks!
Cheers!
Luigino
Hello! I figured out in my jqGrid 4.6.0 to integrate CKEditor to have formatted contents but when I write multiple lines of contents and save, the row height in the jqGrid increases.
I tried to put also in CSS this:
1 |
.ui-jqgrid tr.jqgrow td { white-space: nowrap; height: 20px !important; max-height: 20px !important; } |
but without success… anyone could suggest a trick?
Thanks in advance to all! Cheers, Luigi
About navGrid I solved it by myself….just forgot to put pager:”#pager” in grid's options….
But still I'd like to append next nested subgrids AFTER the first subgrid inside main grid because actually it would be appended between the row and the navgrid… any suggest would be appreciated…
thanks again to all
Ciao,
Luigi
Hello tony and everyone….
about my previous question I solved by myself just creating two empty columns in the colmodel so I could put in the cell:
jQuery(“#mysubgrid”).jqGrid('setCell', 1, 'Action_Yes', fnExpand);
Just now I figured when I expand the row of main grid showing the subgrid, it doesn't show the navGrid toolbar of the subgrid even if I put this:
jQuery(“#mygrid”).html(“
“);
and plus, since I am creating nested grids, then in the onClick's function of the button I append a new grid like:
jQuery(“#mysubgrid”).append(“
“);
inspecting the element with FF I see the div with “test” but it doesn't draw the navGrid…
On the other hand, if first I explode the subgrid, then next subgrids would be appended BETWEEN main subgrid's row and the navGrid of main subgrid instead to be appended AFTER the main subgrid.
Any direction/trick would be appreciate.
Thanks
Ciao,
Luigi
Nevermind, solved by myself… it was some settings related to web.config file…
At least someone could tell me why with the code above in the first post when I press Edit button the form editor doesn't
resize as I want and with “Save” in the submit button?
If I press Add then Cancel and then again I press Edit it goes showing right resize and “Save” in the submit button…
thanks to everyone in advance!
Ciao,
Luigi
Hello OlegK!!
Indeed you were damn right!!! it was that loadonce:true the guilty of my issue eheheh
And now it works.
Thanks a lot again!
Ciao,
Luigi
No suggest about what to check to force reloading grid recalling the PHP in the url parameter about my little issue? (so that PHP would get back all complete data in the grid)
Thanks again
Ciao,
Luigi
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top