Forum



22:23

24/01/2013

Hi,
I have the following XML (which can be chaged)being used to popuilate jqGrid 4.4.1:
<rows>
<row><id>1</id><host>123</host><checked>1</checked>....</row>
<row><id>2</id><host>456</host><checked>0</checked>....</row>
</rows>
I would like my grid to have the checkbox for row #1 checked.
...
grid.jqGrid({
url: 'listHostsXML.php?id='+id,
datatype: 'xml',
caption: "Hosts",
mtype: 'post',
height: 'auto',
hidegrid: false,
loadonce: true,
autowidth: true,
viewrecords: true,
multiselect: true,
rownumbers: true,
rowNum: -1,
edit:false,
add:false,
del:false,
colNames: ['Id','Host',....],
colModel: [{ ... }]
});
10:37

Moderators
30/10/2007

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
11:40

10/08/2009

Hi Tony,
I think that the user want to set multilelect chechbox based on <checked> from the data. One can't define currently any formatter options or some other options for multilelect chechbox ("cb" column) so that the values of the checkbox were set based on the data. So one will have to use the method like setSelection sequencially inside of loadComplete to check the checkboxes. After every setting of checkbox the reflow of the page will take place, so all will be slowly as it could be.
It would be interesting to be able to assign the the value of the chechbox based on the input data or some callback (see the last parameter of addMulti in the line and in the line). If the option deselectAfterSort set to false one can do some triks to fill the chechboxes based on prefilled selarrrow (see the lines of code). One could fill selarrrow for example inside of beforeProcessing. In case of usage datatype: "xml" the corresponding code fragment is missing in addXmlData.
Probably it would be nice to introduce some additional possibilities for developers to control of predefined "cb", "nm" and "subgrid" columns of grid.
Best regards
Oleg
12:14

Moderators
30/10/2007

Hello Oleg,
Thank you for the explanation.
Just I have added onInitGrid event which raises only once before populating the data.
In this event a setColProperties can be used applied for the cb field like this
…jqGrid({
…
onInitGrid : function() {
(this).setColProperty('cb' { attr : function(...){..} });
}
…
});
Hope this make sence since it can be used for other predefined columns.
Thanks
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
19:22

10/08/2009

I find introduction of onInitGrid callback very helpful, but not in you case aram535. What Tony wrote is not exact code. It should be interpreted something like
$(this).jqGrid("setColProp", "cb", {
cellattr: function (rowId, val, rawObject) {
...
}
});
}
The problem is that it helps not to set value of multilect checkbox because the checkbox is control inside of the cell and cellattr allows to set only attributes of the cell (<td> element) itself.
Like I wrote before the part of the code of addJSONData contains some parts of code which can set values of the multilect checkboxes based on the selarrrow array, but the code works only with datatype: "local".
So still don't see any elegant way to load information which multilect checkbox should be loaded. One can implement the selection using loop though data inside of loadComplete and usage of setSelection sequencially, but such solution will be not so quickly as it could be.
Best regards
Oleg
10:57

Moderators
30/10/2007

Hello,
@aram535 , sorry for mistake. It was may error.
The setColProperty does not exists. It should be setColProp instead - as Oleg write.
I'm sorry again, but I think Oleg is right. Will see what I can do.
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
38 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66