Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by German Gonzalez on Feb 06, 2008 05:55
open dhtmlx forum
two combo boxes in a grid (dhtmlxtreegrid v1.4 pro 70813)...

We need to have two combo boxes in a grid. It seemed to be pretty simple, but we must be doing something wrong because it is not working.

We modified the pro_combo.html located in the samples folder:
.
.
.
<script>

mygrid = new dhtmlXGridObject('gridbox');
mygrid.imgURL = "../imgs/";
mygrid.setHeader("Combo1,Combo2,Mode");
mygrid.setInitWidths("150,150,300")
mygrid.setColTypes("combo,combo,ro");
mygrid.init();
mygrid.loadXML("gridCombo.xml");

</script>
.
.
.
and modified gridCombo.xml:
<?xml version="1.0" encoding="UTF-8"?>
<rows>
<!-- commented because it doesn't work...
    <row id="1">
        <cell xmlcontent="1"><value>a</value><url>combo/php/complete.php</url></cell>
        <cell xmlcontent="4"><value>a</value><url>combo/php/complete.php</url></cell>
        <cell>dynamic loading in filtering mode</cell>
    </row>
-->
    <row id="1">
        <cell xmlcontent="0"><value>one</value><url>combo/xml/data.xml</url></cell>
        <cell xmlcontent="1"><value>c</value><url>combo/xml/data2.xml</url></cell>
        <cell>loading from special xml</cell>
    </row>
<!-- commented because it doesn't work...
    <row id="2" selected="1">
        <cell xmlcontent="2">
            <complete>
                <option value="1">one</option>
                <option value="2">two</option>
                <option value="3">three</option>
                <option value="4">four</option>
                <option value="5">five</option>
                <option value="6">six</option>
                <option value="7">seven</option>
                <option value="8">eight</option>
                <option value="9">nine</option>
                <option value="10">ten</option>
            </complete>
        </cell>
        <cell xmlcontent="3">
            <complete>
                <option value="1">one</option>
                <option value="2">two</option>
                <option value="3">three</option>
                <option value="4">four</option>
                <option value="5">five</option>
                <option value="6">six</option>
                <option value="7">seven</option>
                <option value="8">eight</option>
                <option value="9">nine</option>
                <option value="10">ten</option>
            </complete>
        </cell>
        <cell>loading from grid xml</cell>
    </row>    
-->
</rows>

and created a grid2.xml under combo/xml:
<?xml version="1.0" ?>
<complete>
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="c">c</option>
    <option value="d">d</option>
    <option value="e">e</option>
    <option value="f">f</option>
    <option value="g">g</option>
    <option value="h">h</option>
    <option value="i">i</option>
    <option value="j">j</option>
</complete>

The first combo works fine, the second doesn't show the list.

How do we manage to make this approach to work? Please, give us as many options as possible.

Thank you in advance for your help. Regards
Answer posted by Support on Feb 06, 2008 07:05
Combo excell for the grid 1.4 supports three different value for "xmlcontent" attribute
    0 - loading from the separate xml file,
    1- loading in filtering mode,
    2 - loading from grid xml.
If you need to load from static XMl file - jsue use mode "0"

Also there is a new combo excell, which is faster, more flexible and allows different combo modes. 
Latest combo excell and instruction how to use it attached to post.

Attachments (2)
Answer posted by German González on Feb 06, 2008 12:58

Ok... Thank you for your reply. But now when we use the addRow method, new rows are shown with the combos empty (with no options).

How should I reference the URL to the static xml that contains the combo values in the addRow method?

Any ideas?