UPDATE: The early event triggering seems to happen in both IE8 and FF4. For some reasoin, although I was getting two alert notices in FF4, I cannot reproduce that behavior. Also, in both cases, seems like no params are being pased in.
PREVIOUS COMMENT WAS: Actually, to add: IE8 fires once when entering the cell, before the text gets converted to a textbox. In FF4, you get that incorrect behavior and also the apparently more timely post-edit. So, IE8 does it once at the wrong time, and FF4 does it twice, once wrong. (And, in all cases, all params like celname are undefined.)
Working on it, but I need a mouseover override. See my other post entitled: Modify The Mouseover/New Event Needed
Actually, I worked out one way to add IDs. In addCell, line 403. After the line:
row.appendChild(td);
I added the lines:
$(td,t).attr(“id”, “jqGrid_cell_” + row.id + “_” + pos );
$(td,t).addClass(“jqGrid_row_” + row.id );
$(td,t).addClass(“jqGrid_col_” + pos );
(Instead of jqGrid, it would be better to maybe use the grid name, but I don’t know how to get it from there.)
Not sure about where else this may be needed, or how this could ruin anything. Is this appropriate?
Okay, so I noted that there is a kind of tooltip currently.
So, where and how is this behavior set?
First, I want to see if I can modify this behavior. Else, I will have to get more creative…
Sure. I guess it all depends on how it is being done now. For example, when I click a row, it gets highlighted yellow. How would I control that highlight color in a given column?
Yes, column user-feedback on sorting is sorely missing. Useability and what not.
Multi-column sort would be useful also. Ability to sort by a, then b.
BTW, I leave an XML version of this as an “exercise to the reader”.
Tony, I will send another copy of a rev.28 where both my modifications reside.
And, I would rather think: Thank you for all the jqGrid code. Makes my life much easier!!
Oops. The first block of code above should have the JSON object named “retvals”, not “return”.
I have changed my code a little. I isolated returned values to an expected object (like “rows”) named “retvals” (by default) in the returned JSON. The name of the object can be changed in jReader, as other items can.
So, basically, the JSON has to look something like:
{"page":"1","total":"163","records":"1630","return":{"ttlAll":"3636.84","ttl30":"3636.84","ttl60":"0","ttl90":"0"},"rows":[...
Now, I added one more property to the jqGrid called:
returnedData: {}
And, two functions:
$.fn.getReturnedData = function(){
return this[0].p.returnedData;
};
$.fn.getReturnedDataItem = function( key ) {
return this[0].p.returnedData[key];
};
The addJSONData() function only needs:
ts.p.returnedData = data[ts.p.jsonReader.retvals];
to get the JSON object into the jqGrid object. This avoids the need to worry about collision in property names, too.
Then, it can easily be used by calling the getters.
loadComplete: function(){
alert( $("#resultList").getReturnedDataItem("ttlAll") )
}
Does that look appropriate?
That is a KISS approach that is great, except in one scenario: I may want to reuse the data returned in the JSON object in multiple functions, so passing and discarding within loadComplete() limits that ability.
What would be the best way to add the JSON data to the jqGrid object dynamically?
So far, I thought I could add the code below to addJSONData() right after the ts.p.records line, such that any property in the JSON not in the jqGrid object would be added directly:
for(var pr in data) {
// how to avoid someone naming a JSON property like an jqGrid property from stomping on jqGrid property?
if( (typeof(ts.p[pr]) == "undefined") && (pr != "total") && (pr != "rows") ) {
ts.p[pr] = data[pr];
//ts.fn["get" + pr] = function(){return this[0].p[pr];};
//ts.fn["set" + pr] = function(val) { return this.each( function(){this.p[pr]=val;}); };
}
}
I don’t have the calling convention right yet, and I’m not sure I know how to handle the case of pre-existing properties, but what do you think of this approach conceptually?
Re-reading my post, it looks hostile. I did not mean it that way. I meant that I modified your wonderful grid to suit my immediate needs, but if it doesn’t fit your design and architecture, well, I understand and do not want to force anything on anyone. 🙂
I have sent my jqGrid file to your email.
Yes. I noted that in your new rev and assumed that most likely was the reason.
When I diff’ed rev 8 to rev 28, I could find no other code change that would explain it.
Again, thanks for your time. Sorry to have worried you.
Well, you could do it that way.
But, a fundamental problem still remains if you have to pass a big chunk of data to your service even if only doing a GET with no side-effects. Sometimes, you can’t put all your params in the URL because of a variety of reasons: a) would cause the url to exceed allowable URL lengths on some browsers, b) contains non-ASCII chars, etc.
I didn’t think my free code would get push-back. You don’t have to use it if you don’t want it.
But, it works for my uses… Thanks for your time.
Updating to rev.28 fixed the issue. Not sure why, but no time to dwell on the past! 🙂
Yes, I’ve seen that in the example, but there is no way to get user-defined params added and sent via POST is there, or am I being obtuse?
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top