Mark

Forum Replies Created

Viewing 15 replies - 1 through 15 (of 104 total)
  • Author
    Replies
  • in reply to: getGridParam(“colModel”) #92293
    Mark
    Participant

    So yes, it is a bug. The problem is that splice has two /required/ parameters. The first is the index of the point to insert/delete, and the second is the number of elements to delete. (Subsequent parameters are elements to be inserted after the deletes have taken place)

    I'm guessing that most browsers treat the single parameter case as “delete 1”, but chrome treats it as “delete to end of array”.

    Since omitting the second parameter is an error, either behavior is allowed.

    So a simpler (and probably more efficient) fix would be to change it to splice(0,1);

    Mark

    in reply to: Duplicate page in true scrolling #92283
    Mark
    Participant

    The problem seems to be that some (perhaps all) browsers are reporting fractional coords for the top of the table, even though top, padding, scrollTop etc are all integers. So the formula sometimes computes 1.9999999 when it should compute 2. Math.ceil is not the solution, because the same rounding errors could produce 2.00001 and Math.ceil would then compute 3. But Math.round should be good enough.

    I'd still like to figure out where the fractional pixels are coming from – but for now Im pretty sure that Math.round will solve the problem.

    Mark

    in reply to: Duplicate page in true scrolling #92165
    Mark
    Participant

    I dont think so…

    But I /think/ your server code must be misinterpreting the page numbers. Remember that the first page is page 1, not page 0.

    Mark

    in reply to: grid base code simplification #92163
    Mark
    Participant

    While debugging another issue, I was using Fiddler to track network events for my page.

    I noticed that in ie6 and ie7, if you wave the mouse in front of a grid, /lots/ of network events fire. And they're all fetching the same background image.

    I googled around a bit, and found that ie6 has a known bug where setting the background image of an element will cause “flicker”, because it fetches the image from the server (regardless of caching setting). The bug is supposedly fixed in ie7.

    Well, the flicker may be fixed, but fetching the background image certainly isnt. Also, the well documented fix for ie6 'document.execCommand(“BackgroundImageCache”,false,true)' doesnt seem to stop the traffic with either ie6 or ie7.

    Not sure what can be done, except to minimize the changes – so rather than changing the css on every mouseover and mouseout, we should verify that the row has actually changed. That would certainly cut down on the traffic…

    Mark

    in reply to: how to call trigger() with new API ? #92068
    Mark
    Participant

    The point is that “trigger” is a jQuery method – just like “height” or “css”, or “bind”. Its not a part of the grid software at all; it just fires a named event. You can call it on /any/ jQuery element, not just a grid.

    So it would probably be better to not document “trigger” as a grid method at all, and instead add an “events” section where you document “reloadGrid” (with an example of how to fire the event).

    To a certain extent, I agree that it /is/ inconsistent, however. Its not really clear (to me, at least) why this one operation was done via events, while everything else was done via grid methods…

    Mark

    in reply to: is there any benefit to disable legacy API ? #92016
    Mark
    Participant

    None of the grid methods end up in the jQuery.fn namespace, so they cant collide with methods provided by other plugins.

    When you consider that there are functions with names such as showCol, that seems like a pretty significant benefit to me…

    Mark

    in reply to: how to call trigger() with new API ? #92015
    Mark
    Participant

    Yes, you're right. “trigger” is a core jQuery method, so its not affected by new/old api. You still call it as:

    jQuery('#grid').trigger("reloadGrid");

    in reply to: Strange behaviour with selectRow #91996
    Mark
    Participant

    The problem I am having is that when my #masterGrid loads and there are several none unique id fields within that first 30 loaded rows and I click on any row whose id appears more than once in that list of 30 it highlights all the rows with the id I highlighted instead of showing Master Detail information for that id like Safari/FF would

    There's your answer. Ids are required to be unique. If they're not, the grid will misbehave in strange ways. This particular thing may appear to “work” in FF, but lots of other things will fail.

    Mark

    in reply to: beforeRequest: dont works on jqGrid 3.6.2 #91883
    Mark
    Participant

    Tony: I know what changed – beforeRequest used to set “this” to the parameters object, but now it sets it to the grid itself.

    So the correct way to do this would be $.extend($(this).jqGrid(“getGridParam”, “postData”), {newParam:'newValue'}).

    Btw, the old behavior was never documented – so the value of “this” was never guaranteed.

    Mark

    in reply to: another possible column chooser bug #91850
    Mark
    Participant

    My guess is you're doing something wrong… but without know which params you're setting with setGridParam its hard to know.

    The thing to be aware of is that when you reorder the columns, they are reordered in the colModel itself. The grid keeps a record of the permutation of the columns, and when you request data from the server, it re-orders it based on that permutation before loading it into the grid (at least, in the repeatitems:true case – for repeatitems:false the order of the data is irrelevant).

    So if you use setGridParam to replace the colmodel, for example, bad things are going to happen (unless you are very careful).

    Also, if you try to load data into the grid programatically (and not via addJSONData or addXMLData), yuo will have to take account of the new column order.

    Finally, if you're just trying to show/hide columns, and dont want them to be re-ordered at all, you can replace the “done” function in the column chooser with a no-op.

    Mark

    in reply to: delRowData bug on Grid with Multiselect #91764
    Mark
    Participant

    Tony,

    I dont think it /is/ a problem with getGridParam. Its a problem with how its being used. When I call getGridParam, I expect to get the actual grid parameter…

    If the user wants a copy of the array, its easy enough to call $.makeArray on it.

    Or for this case, just iterate downwards…

    Mark

    in reply to: grid base code simplification #91716
    Mark
    Participant

    The ideal solution would be to use the css pseudo class :hover in all browsers that support it (ie everything except ie6), and not have the event handlers at all for most browsers.

    Unfortunately, you cant do that and stay compatible with themeroller, as far as I can tell (this seems to be a flaw with jquery-ui/themeroller).

    Mark

    in reply to: grid base code simplification #91711
    Mark
    Participant

    This last change doesnt look safe – ptr is set by code other than mouseover, so may be pointing at something other than the hover row. That could be fixed by using a different variable (eg hover_row). (Perhaps you did this – I dont see the change in github yet).

    But, I think there is a bigger issue.

    Every time the mouse moves from one sub-element of a row to another sub-element of a row, we get both a mouseout and a mouseover, and so the above code (even after the changes) removes and re-adds the class.

    This will happen eg when moving from one td to another in the same row. But for grids whose cells have complex contents could be happening *a lot* within a single td.

    I think the code as it stands is “correct” (Im assuming the mouseout is guaranteed to come before the mouseover, but havent checked that that is the case), but is certainly going to fire far too often.

    It seems like you could check whether relatedTarget and target are contained in the same row, and only add/remove the class when the row actually changes.

    That would somewhat negate the above change – because now you do two “closest” calls per mouseover/mouseout. But I suspect that most of the time is spent in adding/removing the class (because it causes the document to reflow).

    Mark

    in reply to: Name clash between “id” and Indonesian language code (id) #91415
    Mark
    Participant

    There is a workaround.

    Your beforeSubmit handler can delete the postdata.id field, and add postdata.row_id.

    You need to be careful handling the “add” case (rather than edit), because the grid differentiates the two by checking whether postdata.id == “_empty”.

    You can solve that by /not/ deleting the “id” field (in which case the server will see both id, and row_id), or by adding it back in your afterSubmit function.

    Mark

    in reply to: error message in grid.common.js #91350
    Mark
    Participant

    No.

    formoptions.label is optional. If you've not set it, this error is thrown, but is caught, and ignored by the grid.

    Firebug's “stop on all errors” setting needs to be used with care – if the application is expecting the “error”, and handles it (as in this case) it may not be an error at all. Thats why its not the default firebug setting…

    Mark

Viewing 15 replies - 1 through 15 (of 104 total)

Stay connected with us in your favorite flavor!