Cant you just write a custom unformat function that converts the formatted cell back to a sortable value?
Mark
You can write a beforeSelectRow handler. Here's a link to one I wrote – it doesnt do exactly what you want, but its easy to modify (note that the variable scb is true iff the user clicked on the checkbox):
Mark
Well, use the tabselect event, and keep a flag to say whether or not you've created the grid…
Mark
It'll do that if you create it every time the tab is selected.
I recommend creating it once, the first time its selected, and never again…
Mark
So a quick check suggests this is working. I've also looked at the code, and it seems to do exactly the right thing…
One thought – are you sure your database didnt get corrupted by your earlier experiments?
ie is it possible that the cd_id and cd_table fields really are the same for those two records (even thought they should be different).
Mark
Unfortunately you'll have to fix a lot of other cases too. colModel.width is assumed to be an integer all over the place.
The best fix (unless tony goes to the trouble of fixing every use of colModel width) is to supply integer values for the widths…
Mark
Sounds like a bug…
I've been assuming this is working for me, but havent tested this scenario beyond things looking about right. I may have the same problem in my grid – I'll have to test it.
Mark
But I've tried it, and it does work 🙂
Make sure you're calling it with the correct id…
Mark
Why not just call saveRow from your external function, before calling getRowData…
Mark
I think you want the fields to be editable:true, hidden:true, edithidden:false.
Mark
You're setting the id as an integer, rather than a string (you want “5” rather than 5).
This was fixed a few weeks ago – although Im not sure its in the 3.5.3 release.
Mark
Hi Tony,
No problem – the “true” vs 1 is a little odd.
My logic was that I didnt want to change the behavior of existing scroll=true grids (except to make the scrolling work better). For grids of up to a few hundred rows, its probably better to just keep everything loaded.
And also, I could use eg scroll=n to limit the number of loaded pages – I just hadnt got around to doing it.
Just curious – is your sortableRows built on top of sortable? Or is there some fundamental problem with sortable and table rows?
Mark
Hi Tony,
Thanks – I'll fix the addXMLData parameter.
I think the changes you suggest to enable you to explicitly position the scroll bar should be pretty easy to add on top of my changes.
If you set scroll=1 (rather than true), then it already swaps rows in and out to keep just the needed rows in the DOM. Grab the scrollbar, and scroll down. The display in bottom right will show you “view – 5301-5330 of 15000″ for example.
The algorithm right now is: if more rows are needed at the bottom of the grid, but some of the loaded rows are visible, then append some pages. Otherwise, empty the grid, and just fetch enough pages to cover the visible region.
So, if you scroll down slowly enough, you /can/ get all the rows in the DOM, even with scroll=1. But generally, that wont happen (I've been using this for a few days in my own grid). I should probably tweak the algorithm to additionally throw away rows when you go over some specified threshold.
Also, scrolling backwards is less efficient than scrolling forwards, because it always fetches everything it needs. I need to make some changes to addXmlData and addJSONData to handle inserting new rows ahead of existing ones…
Mark
Since this is requested many times – the plan is to have this in 3.7 release.
Tony,
Ive been working on this for my project… I just pushed the current implementation to markw65/jqGrid.
Basically, it extends the behavior of the existing “scroll” option:
Unfortunately, the exact way to do this varies depending on the callback, but for the beforeSelectRow, just return “true”.
Mark
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top