123456789101112131415161718192021222324252627282930313233343536 |
- body.on('click','#addalgo',function(){addAlgoDialogShow();});
- var pt_list = document.getElementById("pt_list");
- var algo_list = document.getElementById("algo_list");
- pt_list.onchange = function(){ onChangeProjectTypeList(this)};
- function addAlgoDialogShow()
- {
- $("#cont").css("display", "inline-block");
- }
- function onChangeProjectTypeList(selectObj)
- {
- var val = getSelectValue(selectObj);
- var dict = new Object(); //or Map()
- dict['actname'] = 'select_project_type';
- dict['pt_id'] = val;
- sendAjax('', dict, projectTypeChooseResult, 'algo_response.php');
- }
- function projectTypeChooseResult(data) {
- //alert("addalgo "+data);
- var initial = "<Нет алгоритмов>";
- data = JSON.parse(data);
- if (data.length > 0)
- initial = "<Выберите алгоритм>";
- algo_list.innerHTML = "<option value='0'>"+initial+"</option>";
- for (var i=0; i < data.length; i++ ) {
- var algo = data[i];
- algo_list.innerHTML += "<option value="+algo.id+">"+algo.id+" "+algo.id+" Условие: "+algo.c_name+" тип: "+algo.condition_value_id+". Действие: "+algo.a_name+" "+algo.action_value_id+".</option>";
- }
- }
- function getSelectValue(selectObj) {
- return selectObj.options[selectObj.selectedIndex].value;
- }
|