Jan 17, 2012, 4:12 PM
Problems with ComboBox Two Columns
I have a problem when using a combobox two columns.
When you select an item, the combobox is filled with the 1st item and not what I selected
Following is the code:
thank you
When you select an item, the combobox is filled with the 1st item and not what I selected
Following is the code:
<ext:ComboBox ID="cbTurmaDisciplina" runat="server" EmptyText="Selecione a Turma..."
TypeAhead="true" ForceSelection="true" Mode="Local"
DisplayField="dcturma" ValueField="iddisciplina" MinChars="1" ListWidth="300"
PageSize="10" ItemSelector="tr.list-item" BlankText="Escolha uma opção" AllowBlank="false">
<Store>
<ext:Store runat="server" ID="TurmaDisciplinaStore">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="iddisciplina" ServerMapping="Disciplina.Iddisciplina" />
<ext:RecordField Name="dcdisciplina" ServerMapping="Disciplina.Dcdisciplina" />
<ext:RecordField Name="dcturma" ServerMapping="Turma.Dcturma" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
<Template ID="Template1" runat="server">
<Html>
<tpl for=".">
<tpl if="[xindex] == 1">
<table class="cbTurmas-list">
<tr>
<th>Turma</th>
<th>Disciplina</th>
</tr>
</tpl>
<tr class="list-item">
<td style="padding:3px 0px;">{dcturma}</td>
<td>{dcdisciplina}</td>
</tr>
<tpl if="[xcount-xindex]==0">
</table>
</tpl>
</tpl>
</Html>
</Template>
<Triggers>
<ext:FieldTrigger Icon="Clear" HideTrigger="true" />
</Triggers>
<Listeners>
<BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
<TriggerClick Handler="if (index == 0) { this.focus().clearValue(); trigger.hide();}" />
<Select Handler="this.triggers[0].show();" />
</Listeners>
</ext:ComboBox>
CODE-BEHIND:protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
}
DcplLecionadas dcpl_lecionada = new DcplLecionadas();
DcplLecionadasBO dcpl_lecionada_bo = new DcplLecionadasBO();
dcpl_lecionada.Professor = new Professores();
dcpl_lecionada.Professor.Idprofessor = 43; //Convert.ToInt32(Session["idorigem"]);
List<DcplLecionadas> list = new List<DcplLecionadas>();
list = dcpl_lecionada_bo.fillComboBoxTurmaDisciplina(dcpl_lecionada.Professor);
TurmaDisciplinaStore.DataSource = list;
TurmaDisciplinaStore.DataBind();
}
When debugging I see that the datasource is no problem, the problem only occurs when I select, but is displaying the values correctly.thank you
Last edited by Daniil; Jan 19, 2012 at 12:29 PM.
Reason: Please use [CODE] tags