Nathan said:
On a side note, can a field span two columns ?
The default for tabs is that hidden tabs get “display:none”. The result of that is that the container size is reported as zero.
So when the grid in the hidden container initializes, /its/ container has zero size, and it sizes itself accordingly.
You have a couple of options:
I did read what mark said, multiboxonly seems to be the right path to give the effect but when I click a row it don't seems to be selected (it's kind of obvious because you need to click the check-box in order to select the row), so when i try to retrieve the selected row, there won't be any selected row. I tried this before got here in the forum.
It may seem obvious – but its not correct… with multiboxonly set to true, you have to click on the check box to get multiselect behavior; but clicking elsewhere on the row gives you uniselect behavior (I've just tested this – it works perfectly).
What I really want to know is why the information is moved one cell to the left? Like in the picture in the first post. Why is this happening when i do jQuery(NOMBRE_GRID).setGridParam({ multiselect: false }).hideCol('cb') in jQuery(document).ready ?
Because changing the multiselect option after creating the grid is not supported.
I don't know if i need to clarify again. I wrote down an event when a button is clicked on the page and i set this instruction
jQuery(NOMBRE_GRID).setGridParam({ multiselect: false }).hideCol('cb')
and is perfectly working.
No, it isnt. Try refreshing the grid to see that.
Why does it /appear/ to work when you use a button, and not when you use $(document).ready? Well, its because in the latter case, the data comes back from the server /after/ you change the multiselect flag – and any time the grid fetches data from the server when the multiselect flag has been changed, things are going to go wrong. But as I said above, if you cause the data to be refreshed it will fail in both cases…
But here's a question – since you create your grid in a $(document).ready handler, and you change the setting in a $(document).ready handler, why not just create it with the correct setting anyway?
Mark
You cant change the multiselect option after creating the grid (well, you could, but you would have to update lots of other internal grid state).
But note that setting multiboxonly results in uni-select behavior except when clicking on the checkbox.
So if you set that, and hide the checkboxes, you should get what you want:
jQuery(NOMBRE_GRID).setGridParam({ multiboxonly: true }).hideCol('cb');
Its also possible to set an onBeforeSelect handler, which effectively gives you complete control over how clicking on rows affects the selection (I dont think you need to do this – but if you ever need more control than the standard options give you, thats the way to do it).
Mark
tony said:
Hello,
In some IE browsers you will have problems when you use the loader. Also load the needed modules in the head section of the html -one by one in order to work in all browsers.
Reagrds
Tony
Tony – you should be able to fix that in the loader by:
if (jQuery.browser.msie) {
Right – my fix was qualified by “if the goal is…” 🙂
Perhaps a better fix would be to drop the “border:0 none” for the selected row – although that causes a 1px shift down and to the right of the contents of the selected row…
the setGridParam fails in a similar way.
Tony,
I think its a bug – there's a precedence problem in ui.jqgrid.css.
Here's the relevant css:
You mean like the onSelectAll event?
Mark
As tony said, hideCol('cb') to hide the checkboxes, and there's a function here that will give you the “usual” shift/ctrl click select behavior.
Mark
Tony
Just a note – setLabel has a bug: If you change the column label, it blows away the content of the div which includes the sort icons.
Mark
Here's another one (I posted a more complex variant a few weeks ago – tony has since added the event parameter to the beforeSelectRow handler, which makes it much cleaner now).
Just set this as the beforeSelectRow handler (it will take care of shift and ctrl clicks in the “expected” manner).
function multiSelectHandler(sid, e) {
According to the jquery page, here is the complete list of chars that need quoting: #;&,.+*~':"!^$[]()=>|/
So clearly there's a few more that need adding 🙂
Also, rather than adding a series of replace calls, it could be written: sid.replace(/([\#\;\&\,\.\+\*\~\'\:\"\!\^\$\[\]\(\)\=\>\|\/])/g,"\\$1");
Or maybe just quote everything but the “usual selector chars”: sid.replace(/([^-a-zA-Z_0-9])/g, “\\$1”);
Hi Tony,
I understand.
To make things a little easier (and to help with the step-by-step), I've simplified things a little. I've just checked in a new version in my fork of the grid. There are now two branches. “master” and “newapi”.
On the master branch, I've added a function $.jgrid.extend() which extends both $.fn and $.fn.jqGrid with its argument. I've also changed every call to $.fn.extend into a call to $.jgrid.extend, and also modified $.fn.jqGrid to handle string arguments as before.
The upshot is that there's only a small number of changes, but it supports the new calling convention ( .jqGrid(“method”,args) rather than .method(args)). But it doesnt allow you to turn off the “old” calling convention (because the grid itself still uses that).
Then, on the “newapi” branch, I've also changed all the call sites to those functions to use the new calling convention. Obviously, a lot more changes, and much harder to verify.
Im hoping you can pull in the master changes before too long. Once those are in, I should be able to keep the newapi branch up to date fairly easily (I have a script to convert between the two calling conventions).
Hopefully, in the long run, you'll take the newapi changes too – but I can see that thats going to be harder.
Mark
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top