Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
collapsetrue
//when creating the control, the id is in the following format "LookupMaintComboBox" + PanelName + TableName
//code added to the init to attach the handler
LookupMaintComboBoxLocationluLocation.valueOf().ValueChanged.AddHandler(function () {
  publicMethods.LookupComboBoxChangeValue(LookupMaintComboBoxLocationluLocation.GetValue());
});




//new public function
LookupComboBoxChangeValue: function (selectedCode) {
    try {
        var ajaxModel =
        {
            action: 'GetLookupTableRow',
            LookupTable: 'luLocation', //replaceTableName
            Code: selectedCode,
            getdataflag: _ajax.returnData.Yes
        };
        $.ajax({ type: 'POST', url: _locationAjaxURL, data: ajaxModel })
        .done(function (dData) {
            privateMethods.RefreshData(JSON.parse(dData.Data));
        })
        .fail(function (fData) {
            _em.OnError(_controls.ErrorControl, new Error(fData.responseJSON.ServerMessage), '_Syn.{0}.Panels.{1}.{2}'.IFormat(_SynMaintPage, PanelName, 'Load'));
        })
        .always(function () {
            _me.loadingPanel.Hide();
        });
    }
    catch (e) {
        _em.OnError(_controls.ErrorControl, e, '_Syn.{0}.Panels.{1}.{2}'.IFormat(_SynMaintPage, PanelName, 'Load'));
    }
}

...