Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dirk on Dec 12, 2007 02:51
open dhtmlx forum
ComboBox: Additional Information in List

Regarding to my question on 6th Dezember:

By adding data I haven't ment to add new data to the list.
Now I try to better describe.

I have a list which I load with XML. The XML-Data is like this:

<?xml version="1.0" ?>
<complete>
    <option value="hackstr">Hackstr</option>
    <option value="hammerstein">Hammerstein Str</option>
    <option value="hanseatengasse">Hanseatengasse</option>
    <option value="hauptstrasse1">Hauptstrasse</option>
    <option value="hauptstrasse2">Hauptstrasse</option>
    <option value="hauptweg">Hauptweg</option>
    <option value="hauptbahnhof">Hauptbahnhof</option>
    <option value="herdweg">Herdweg</option>
    <option value="heuweg">Heuweg</option>
    <option value="holsteinufer">Holsteinufer</option>
    <option value="hopfenstrasse">Hopfenstrasse</option>
</complete>

Now, as you can see the entry "Hauptstrasse" is displayed twice, because this street exists in two different cities.
But when I show this list the user wouldn't be able to see the difference between this two streets. Now I have
to add the city information to the list. So the data will be:

...
<option value="hauptstrasse1">Hauptstrasse, 77548 Grossstadt</option>
<option value="hauptstrasse2">Hauptstrasse, 77625 Kleinstadt</option>
...

Now the user is able to choose the right street between this two same-named streets.
But the entry in the input field will now the whole data "Hauptstrasse, 77548 Grossstadt"
but there should be only the "Hauptstrasse".

So my question is, if it's possible to add additional data to each listentry which will not
be taken to the input field?

Like:
<option value="hauptstrasse1">Hauptstrasse<span class="addinfo">, 77548 Grossstadt</span></option>
<option value="hauptstrasse2">Hauptstrasse<span class="addinfo">, 77625 Kleinstadt</span></option>

Regards

Dirk
Answer posted by Support on Dec 12, 2007 04:57
The current "co" excell ( same as "coro" and "combo" ) doesn't support such functionality. By default, label shown in cell is exactly the same as label shown in select list.
But it pretty easy to update code, so it will work as necessary in your case.

dhtmlxgridcell.js , line 857

eXcell_co.prototype.setValue = function(val){
    ....
    this.setCValue(((this.cell._combo||this.grid.getCombo(this.cell._cellIndex)).get(val) || val ).split(",")[0] ,val);

code which need to be added marked in bold, it will show as cell value text before first comma, while in select list full data will be shown