zoukankan      html  css  js  c++  java
  • select box 联动

    //查询表格,取得去重复的name
    var queryPro = Class.create();
    queryPro.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
       queryPro_info:function(){
        var answer;
     var gr = new GlideAggregate('x_178251_my_applic_mypro');
             gr.groupBy('bname');
             gr.query();
        while(gr.next()){
       answer=this.newItem("ans");
              answer.setAttribute('q_bname',gr.bname);
    }  
       },
        type: 'queryPro'
    });
    //将查询到的去重后的name塞到select box中
    function onLoad() {
    //Type appropriate comment here, and begin script below var ga=new GlideAjax("queryPro"); ga.addParam("sysparm_name","queryPro_info"); ga.getXML(callback); var b_name=''; function callback(response){ var answer=response.responseXML.getElementsByTagName("ans"); for(var i=0;i<answer.length;i++){ b_name=answer[i].getAttribute('q_bname'); g_form.addOption("bPro",b_name,b_name); } } }
    //根据选择的name值再次查询
    function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') { return; } var bPro_value=g_form.getValue("bPro"); var ga=new GlideAjax("addPro"); ga.addParam("sysparm_name","addPro_info"); ga.addParam("sysparm_getbname",bPro_value); ga.getXML(callback); function callback(response){ var answer=response.responseXML.getElementsByTagName("res"); g_form.clearOptions("mPro"); for(var i=0;i<answer.length;i++){ var mPro_value=answer[i].getAttribute('q_mname'); //alert(answer[i].getAttribute('q_mname')); g_form.addOption("mPro",mPro_value,mPro_value); } } //Type appropriate comment here, and begin script below }
    //根据前台得到的select box的值,再次查询表格得到要联动的select box的值
    var addPro = Class.create(); addPro.prototype = Object.extendsObject(global.AbstractAjaxProcessor, { addPro_info:function(){ var b_name=this.getParameter("sysparm_getbname"); var gr=new GlideRecord('x_178251_my_applic_mypro'); gr.addQuery("bname",b_name); gr.query(); while(gr.next()){ var result=this.newItem("res"); result.setAttribute('q_mname',gr.mname); } }, type: 'addPro' });
  • 相关阅读:
    HEAP[xxx.exe]:Invalid Address specified to RtlValidateHeap 错误的解决方法总结
    C语言中对于结构的定义一般放在.h中还是.c中
    MFC线程(三):线程同步事件(event)与互斥(mutex)
    AfxOleInit()和::CoInitialize(NULL)区别
    C++格式化字符函数
    使用数据库连接池优化程序性能
    一个经试用效果非常不错的数据库连接池--JAVA
    VC:CString用法整理(转载)
    Apache配置多个监听端口和不同的网站目录的简单方法(转)
    Dedesql数据库类详解
  • 原文地址:https://www.cnblogs.com/yanweichen/p/8007202.html
Copyright © 2011-2022 走看看