Ok tony,
I have sended you the grid.inline.js.
thanks.
Josep Escofet
If somebody wants de grid.inline.js modified ask me , and I send my
copy with the problem of onerrorfunc solved(session expired,
error saving on server) and with another
function afterCancelFunc a callback function that is called when
the ESC key is pressed on a row.
thanks.
Josep Escofet
The code is not all visible on the screen , there is some method for post the
code correctly ?
Tony, do you want to put this for all?
thanks.
Josep Escofet
Hi,
I have finished the solution and I posted here, I put the full complet
saveRow function, the only think that I have made is to change the
call to $.post for $.call and clean some code not necessary.
This functions resolves the problem of session expired when
you are going to make a row to save and if there is a problem
saving row on server and it responds with some error code
(400, 404,500….) not 200 OK code.
saveRow : function(rowid, succesfunc, url, extraparam, aftersavefunc,errorfunc) {
Hi Tony,
I have found the solution, now I am cleaning the code and doing
the last test… and after I will post the solution.
The key is not to use $.post function becouse this function
doesnt call the callback function in case of the response is not success,
then if you use the $.ajax fucntion with onerror: callback function.
I have tested the first solution and it works.
When I finished the code I will post, perhaps later or tomorrow.
this solution catches the session expired too.
thanks.
Josep escofet
Hi tony,
I have look the code again and I think that your solution is
wrong becouse the callback function is never called if the
response of the server is not success, then the if into the function
that says : if (stat === “success”){ is never called if the response
is wrong becouse the callback function is never called.
I have tested it and if the response is success the function is
called, but if it is wrong (404, 500….) the function is never called,
just put an alert before if (stat === “success”) and you will see that
the function is never called.
thanks,
I think that this is not the problem, with my last test , I
have the session active, and I forced an error on every row
save, with a header(404) or (500) and the function onerrorfunc
is never called, then I look at inline.js and I have found :
$.post(url,tmp,function(res,stat){ function on saveRow.
I have looking at documentation on jquery and I have
found that :
This is an easy way to send a simple POST request to a server
without having to use the more complex $.ajax function. It
allows a single callback function to be specified that will be executed
when the request is complete
(and only if the response has a successful response code).
then in case of error (404, 500,…) the onerrorfunc is never called.
is it ok? Is it a bug?
thanks.
I send again the functions.
jQuery(grid).editRow(actualRow, true, null, errorAjaxServer,
url, null, checkSave, onErrorServer);
jQuery(grid).saveRow(actualRow, errorAjaxServer, url,
null, checkSave, onErrorServer);
function onErrorServer(rowid, result){
Hi Tony,
I have been another test, when I modify a row and the row is saved to
the server, I am throwing and error(404) with java
( response.sendError(404) ) and the onerrorfunc is not called.
But my application detects it and send to the client a page with the custom
error for 404, but the grid doesnt catch it.
I am calling the onerrorfunc :
jQuery(grid).editRow(actualRow, true, null, errorAjaxServer, url, null, checkSave, onErrorServer);
jQuery(grid).saveRow(actualRow, errorAjaxServer, url, null, checkSave, onErrorServer);
function onErrorServer(rowid, result){
In our project , we utilize struts and Jsp, j2ee, java, and when an error
ocurs we dont generate any http header error, we are calling the same
page that has generated the error but with some message in a div.
Then when the server responds and the grid method are called, the
response of the server can be catched and parsed to see if there is an
error and then
Hi,
I am adding the full grid.inlinedit.js becouse can it be difficult for newbies to
modify this.
I add too the call to the edit row, if the edit it is cancelled, the function
checkCancel2 will be called, it can be util for example if you want buttons that appear and disappear relative to the real possible operations and dont
have all buttons always displayed for possible operations not applicable at certain momment.
//
Thanks tony,
I have made the sort at the server side, and now it is working perfectly.
thanks a lot.
Josep Escofet
thanks Tony,
But if you put loadonce=true the data is sorted when you click some col,
is it done for the javascript in the client side?
Josep Esofet
This data is a sample constructed from server, Struts action populates a
List and the list is putted on session and after there is a jsp file that renders
this list as xml file. The original data comes from database thru sql, but
too it is putted on list and after there is a jsp file that renders this data.
An example with original data is here :
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
1 |
|
1 |
13 |
|
1 |
13 |
|
1 |
|
1 |
|
1 |
8 |
|
1 |
*CIAL.TEXTIL ARBITEX/3 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
45103397577 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
9 |
|
1 |
*CIAL.TEXTIL ARBITEX/4 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
12 |
|
1 |
*CIAL.TEXTIL ARBITEX/7 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
13 |
|
1 |
*CIAL.TEXTIL ARBITEX/8 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
14 |
|
1 |
*CIAL.TEXTIL ARBITEX/10 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
45103397577 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
21 |
|
1 |
*CIAL.TEXTIL ARBITEX/12 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
24 |
|
1 |
*CIAL.TEXTIL ARBITEX/14 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
28 |
|
1 |
*CIAL.TEXTIL ARBITEX/1 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
29 |
|
1 |
*CIAL.TEXTIL ARBITEX/5 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
30 |
|
1 |
*CIAL.TEXTIL ARBITEX/6 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
35 |
|
1 |
*CIAL.TEXTIL ARBITEX/2 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
37 |
|
1 |
*CIAL.TEXTIL ARBITEX/11 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
38 |
|
1 |
*CIAL.TEXTIL ARBITEX/16 PROD.ACCIDENTES |
|
1 |
|
1 |
01000000128 |
|
1 |
01000000128 |
|
1 |
45103397577 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
|
1 |
Hi Tony,
I have tested your solutions but it not work for me.
When It is default option loadonce:false, every time that I click in one
column it is calling to server and asking the file.xml of the rows, the server charges the file correctly but it is not ordered.
When I put loadOnce:true , every time I click the column the list is displayed ordered, but not is calling to server for refreshing data. I have tryed too
put loadOnce:true and when the user push a button :
$(”#mygrid”).setGridParam({loadonce:'false'}).trigger(”reloadGrid”)
but it is not calling to the server for refreshing data.
I send you the jQgrid defiition and the xml file. I dont understand what is happening.
jqgrid definition:
jQuery(document).ready(function(){
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top