Closed GoogleCodeExporter closed 8 years ago
I try to explain it a bit different:
I would like to be able to define the values and labels for the options:
{type: "select",values: ["val1","val2"],labels:["label1","Label2"]}
this way i can do a search for a certain value, but give it another name in the
select dropdown.
in the columnfilter code is a loop to extract all the values from the aData
array.:
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
I just can't figure out how i can get the labels in another array.
any idea is more then welcome.
Original comment by rob...@gmail.com
on 15 Jul 2011 at 2:46
This functionality is not builtin, but the way I would handle it would be to do
something along the lines of:
{ type: "select", options: [{'value': 'val1', 'label': 'label1'}, {'value':
'val2', 'label': 'label2'}, {'value': 'val3', 'label': 'label3'}] }
and perhaps:
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
This is untested code but should get you on the right path.
Original comment by gerard.d...@cwlake.com
on 29 Jul 2011 at 2:53
On second thought, this would allow the code to be backwards compatible:
if(typeof(aData[j]) != 'object')
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
}
else {
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
}
Again untested, but that should allow it to work with the old method as well as
the method you are trying to use.
Original comment by gerard.d...@cwlake.com
on 29 Jul 2011 at 3:01
I had a missing { in that if statement, it should have been:
for (j = 0; j < iLen; j++) {
if(typeof(aData[j]) != 'object') {
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
}
else {
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
}
}
Still haven't tested that this actually works, but I have included it in my
version and it no longer throws errors for simply being there.
Original comment by g.duerrm...@gmail.com
on 29 Jul 2011 at 3:20
Well actually I ended up needing this functionality myself so I went ahead and
finished the code. Basically what I provided earlier was almost working, I just
hadn't followed everything through.
To ensure backwards compatibility, you would need to use this:
{ type: "select", values: [{'value': 'val1', 'label': 'label1'}, {'value':
'val2', 'label': 'label2'}, {'value': 'val3', 'label': 'label3'}] }
(Note that we are keeping "values" instead of "options" as I had originally
used. I think "options" is better named, but it breaks backwards compatibility.)
Then this change to the option looping, again ensuring backwards compatibility:
for (j = 0; j < iLen; j++) {
if(typeof(aData[j]) != 'object') {
r += '<option value="' + aData[j] + '">' + aData[j] + '</option>';
}
else {
r += '<option value="' + aData[j].value + '">' + aData[j].label + '</option>';
}
}
I have tested this as working. Good luck!
Original comment by g.duerrm...@gmail.com
on 20 Aug 2011 at 10:56
Original comment by joc...@gmail.com
on 24 Sep 2011 at 11:03
Hi,
This code is added in the version 1.2.4.
Thanks,
Jovan
Original comment by joc...@gmail.com
on 25 Sep 2011 at 12:33
Great, thank you for including that in!
Original comment by g.duerrm...@gmail.com
on 25 Sep 2011 at 10:48
nice job!
Tnx
Rob
Original comment by rob...@gmail.com
on 26 Sep 2011 at 5:04
Original issue reported on code.google.com by
rob...@gmail.com
on 13 Jul 2011 at 10:40