WebCombo ClientSide databind

1 reply. Last post: March 3, 2013 11:55 PM by Hans Kristian
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

I have following code:

function success(msg) {
    var combo = ISGetObject('cmbGodina');
    var rows = combo.GetRows();
//    if(rows.length > 0){
//        for(var i = 0; i < rows.length; ++i){
//            rows.Remove(rows[i], true);
//        }
//    }
//    combo.UpdateUI();
    var dataTable = new ISDataTable();
    var idColumn = new ISDataColumn(dataTable);
    var naziv = new ISDataColumn(dataTable);
    var datumDo = new ISDataColumn(dataTable);
    var xsltFile = new ISDataColumn(dataTable);
    var procFile = new ISDataColumn(dataTable);
    dataTable.Name = dataTable.TableName = "Root";
    idColumn.Name = idColumn.ColumnName = "IdObrasca";
    naziv.Name = naziv.ColumnName = "Naziv";
    datumDo.Name = datumDo.ColumnName = "DatumDo";
    xsltFile.Name = xsltFile.ColumnName = "XsltFile";
    procFile.Name = procFile.ColumnName = "ProcFile";
    dataTable.Columns.Add(idColumn);
    dataTable.Columns.Add(naziv);
    dataTable.Columns.Add(datumDo);
    dataTable.Columns.Add(xsltFile);
    dataTable.Columns.Add(procFile);
    $(msg).find('Table').each(function (i, row) {
        $(row).find('Field').text();
        var dataRow = dataTable.NewRow();
        dataRow.Cells.GetNamedItem("IdObrasca").Value = $(row).find('IdObrasca').text();
        dataRow.Cells.GetNamedItem("Naziv").Value = $(row).find('Naziv').text();
        dataRow.Cells.GetNamedItem("DatumDo").Value = $(row).find('DatumDo').text();
        dataRow.Cells.GetNamedItem("XsltFile").Value = $(row).find('XsltFile').text();
        dataRow.Cells.GetNamedItem("ProcFile").Value = $(row).find('ProcFile').text();
        dataTable.Rows.Add(dataRow);
    });
    combo.SetDataSource(dataTable);    
    combo.DataBind();
    combo.Render();    
}

 msg is xml returned by webmethod on serverside. Everything works well, but I can't clear webcombo data before i bind it to another source. the commented lines of code, when uncommented, produce error "Unable to get value of the property 'rowIndex': object is null or undefined"

this is my combo:

<iswebcombo:WebCombo ID="cmbGodina" runat="server" AllowWildCardSearch="false" Width="200" 
                        Height="20" DataValueField="IdObrasca"
                        ViewStateStorage="None" BindingOperationMode="ClientBinding" DataTextField="Naziv">
                        <LayoutSettings ComboMode="MultipleColumns" EnableAnimation="False" AlwaysShowAllRowsOnDropdown="true" 
                            EntryMode="AutoComplete" StatusBoxPosition="Top" StatusBoxVisible="false">
                            <ClientSideEvents  OnAfterItemSelected="cmbGodina_OnAfterItemSelected" />
                        </LayoutSettings>
                        <Columns>
                            <iswebcombo:WebComboColumn Name="Naziv" HeaderText="<%$GetString:{%00_pub_Name%}%>" BaseFieldName="Naziv" Width="200" />
                            <iswebcombo:WebComboColumn Name="DatumDo" Hidden="true" RenderOnHidden="true" BaseFieldName="DatumDo" />
                            <iswebcombo:WebComboColumn Name="XsltFile" Hidden="true" RenderOnHidden="true" BaseFieldName="XsltFile" />
                            <iswebcombo:WebComboColumn Name="ProcFile" Hidden="true" RenderOnHidden="true" BaseFieldName="ProcFile" />
                        </Columns>
                        <ClientBindingSettings DataSourceType="ClientDataSource" />
                    </iswebcombo:WebCombo>

 

All times are GMT -5. The time now is 4:56 PM.
Previous Next