ExtJS Combo学习,相关参数属性解析

ExtJs之ComboBox篇 其实我感觉如果大家看过上一篇GridPanel之后对ComboBox的绑定应该很容易了。在这里,我们的demo仍然是动态绑定的(其实这是女朋友问我的一个问题,她当时问我怎么动态绑定ComboBox,我就做了下面的demo)。动态绑定的放其实和GridPanel一样,采用load传参。在GridPanel中我就曾说过,ext中很多组件都可以使用load来实现动态传参的(TreePanel除外)。 ComboBoxd动态绑定 前台代码: 后台代码: 运行效果: 上图正是在点击不同button之后 阅读详情

 5.服务器数据作为ComboBox的数据源实例
首先从服务器获取json数据:

//cs后台代码,简单起见,示例而已,要主要字符串格式(新手注意,下面的代码放在类里面,不是放在方法里)
public string  ServerData="['湖北','江西','安徽']";

 

//aspx前台js介绍代码 
Ext.onReady(function(){
       
var combo=new Ext.form.ComboBox({
            store:
<%=ServerData%>,//获取ServerData的string值,不要用""引起来,否则就不是object数据,而是字符串,这是一个很巧妙的关键点:把服务器的字符串转化为js的object数据,是不是超级方便。
            emptyText:
'请选择一个省份....',
            applyTo: 
'combo'
        });
    });

 

//aspx前台html代码
<input type="text" id="combo" size="20"/>


我们就通过<%=ServerData%>这样的方式获取到了服务器最简单的属性数据。问题来了,js和html怎么调用c#后台
的变量和方法?(变量的调用上面刚刚介绍)
6.js和html怎么调用c#后台的变量和方法
关于这个话题,我不多说,网上很多讲解,在此仅简单说明
1.js调用c#后台变量,参考上面,注意,如果想获取string类型,请在js里用引号 var str="<%=ServerData%>"(返回"['湖北','江西','安徽']")
2.js调用c#后台方法:

<!--后台有一个方法:
public string ServerData()
    {
        return "fdfdfdfdsf";
    }
前台代码:
-->
<input id="Text2" type="text" value="<%=ServerData()%>"/>

3.js调用c#后台带参数的方法

<!--public string ServerData(string pram)
    {
        return pram+",我是参数传进来的";
    }
主要是处理好js的引号问题,多尝试就会正确
-->
<script>alert('<%=ServerData("谦虚的天下") %>');</script>

好了,现在我们有了js获取后台数据的方法手段,不怕不怕啦,不过,这只是一小步。
7.ComboBox的数据源store格式详解
在前面的例子里面,我们一直给ComboBox的数据源store赋值一维数组,其实store支持多维和Store.data.Store类型。

//下面就几种数据以代码举例说明
1.一维数组:["江西","湖北"],值同时赋给ComboBox的value和text
2.二维和多维数组:[["one","bbar","111"],["two","tbar","222"]],第一维和第二维分别赋值给value和text,其他维忽略
3.store类型:包括GroupingStore, JsonStore, SimpleStore.
    
//我们分三步走:
     //第一步:提供数据:
         var 
data=[['湖北','hubei'],['江西','jiangxi'],['安徽','anhui']];
    //第二步:导入到store中:
         var store = new Ext.data.SimpleStore({
             fields: [
'chinese', 'english'],
             data : data
        });
     
//第三步 :把store托付给comboBox的store
    var combo = new Ext.form.ComboBox({
        store: store,
        displayField:
'english',//store字段中你要显示的字段,多字段必选参数,默认当mode为remote时displayField为undefine,当select列表时displayField为"text"
        mode: 'local',//因为data已经取数据到本地了,所以'local',默认为"remote",枚举完
        emptyText:'请选择一个省份...',
        applyTo: 
'combo'
    });


这里我们介绍了两个新的参数displayField和mode,请记住,后面不再专门说明。
8.ComboBox的value获取
添加listeners事件:

//ComboBox的事件很多(api),我们无法一一讲解,但是我们可以举一反三,select事件就是其中典型的一个       
              listeners:{
                
"select":function(){
                            alert(Ext.get(
"combo").dom.value);   //获取id为combo的值
                         }
            }
//这里我们提供了一种不是很好的方法,在此不做过多停留


9.把Extjs的ComboBox样式应用到select的下拉框中去
核心参数介绍

transform:id//用于转换样式的,TimeField作为ComboBox的子类也有此属性

核心代码:

//js代码
var ExtSelect=new Ext.form.ComboBox({
             transform:
"select",//html中的id
             width:80//宽度
         });
//html代码
<select id="select">
        
<option value="1">***</option>
        <option value="2">博客园</option>
        <option value="3">百度</option>
        <option value="4">新浪</option>
    </select>
//是不是超级简单?

     从中不是也可以看出extjs的不同之处的,不过不明显!
10.ComboBox的其他重要参数

1.valueField:"valuefield"//value值字段
2.displayField:"field" //显示文本字段
3.editable:false//false则不可编辑,默认为true
4.triggerAction:"all"//请设置为"all",否则默认为"query"的情况下,你选择某个值后,再此下拉时,只出现匹配选项,如果设为"all"的话,每次下拉均显示全部选项
5.hiddenName:string //真正提交时此combo的name,请一定要注意
6.typeAhead:true,//延时查询,与下面的参数配合
7.typeAheadDelay:3000,//默认250
//
其他参数,请参考api,或自行尝试

关于combobox的其他花俏功能在此不多做介绍。

wsl --install 不执行,显示帮助信息 在安装使用wsl的时候碰到了wsl --install 不执行,而显示帮助信息,提供了解决方案。 阅读详情

相关推荐

深入分析大众点评 Ajax 接口:直接请求 JSON 数据高效获取评论

大众点评网站采用前后端分离架构,通过Ajax接口动态加载数据。按F12打开开发者工具,切换到Network(网络)面板。实际环境中,我们需要使用Python重现这一加密逻辑。查看请求响应,寻找包含评论数据的JSON接口。参数是大众点评的反爬机制核心,需要特别处理。:尊重网站的robots.txt文件规定。:仅将数据用于合法合规的研究和分析目的。:不侵犯大众点评的商业秘密和知识产权。打开大众点评网站,进入任意商户页面。:对采集到的用户信息进行脱敏处理。:避免对目标网站造成过大负担。

Z_suger7的博客 1599

ExtJs之combobox详解

1.服务器数据作为ComboBox的数据源 实例首先从服务器获取json数据: //cs后台代码,简单起见,示例而已,要主要字符串格式(新手注意,下面的代码放在类里面,不是放在方法里)publicstringServerData=”['湖北','江西','安徽']“; //前台js介绍代码Ext.onReady(function(){varcombo=newExt.form...

ama7449的博客 457

Western blot (WB) 灰度分析进阶指南:ImageJ 高效定量技巧与实战优化

本文详细介绍了使用ImageJ进行Western blot灰度分析的进阶技巧,包括批量处理、背景校正和疑难条带处理等实战优化方法。通过自动化宏脚本和动态背景校正,显著提升分析效率和准确性,特别适合科研人员处理复杂WB数据。

weixin_42557830的博客 920

ExtJS笔记--Ext.form.ComboBox

  Ext.form.ComboBox 类全称: Ext.form.ComboBox 继承自于: Ext.form.TriggerField   一个提供自动完成、远程加载、分页和许多其他特性的组合框。   配置项 1、transform : Mixed  要转换为组合框的id,DOM节点或者已有的select元素。   2、lazyRender : Boolean  ...

wjt276的专栏 838

Spatio-Temporal Graph Convolutional Networks: A Deep Learning Framework for Traffic Forecasting 论文笔记

Spatio-Temporal Graph Convolutional Networks: A Deep Learning Framework for Traffic Forecasting 论文笔记-----GCN在交通领域的应用(二) 一、论文翻译: 1、摘要: 及时准确地交通预测对于城市交通控制和指导具有至关重要的意义。由于交通流量的非线性和复杂性,传统的方法不能满足中长期预测任务的需求,并且往往会忽略时空数据的时间和空间依赖特性。在这篇论文中,为了处理在交通领域的时间序列预测问题...

cy_believ的博客 1924

【AI 编程工具进阶用法】如何在Cursor、Trae等工具中使用Skills

OpenSkills是一个开源项目,用于在Cursor、Trae等AI编程工具中添加可复用、可组合的"能力模块"。安装流程包括:1)全局安装OpenSkills CLI工具;2)选择安装Anthropic官方Skills到项目或全局;3)创建AGENTS.md文件同步Skills;4)在AI工具中调用Skills。此外还介绍了UI/UX Pro Max Skill项目,通过npm安装后可为AI添加设计能力。这些Skills相当于为AI工具安装"高级技能包"

肌肉金轮的博客 3558

extjs combobox 下拉列表菜单学习

⭐️来自很多年前的extjs笔记,只是一个归档,不做更新!⭐️

西京刀客 3729

逆向解析M团外卖mtgsig与waimai_sign加密参数实战指南⊙ω⊙

本文详细解析了M团外卖App中mtgsig与waimai_sign两个核心加密参数的逆向分析与生成方法。通过抓包定位、静态逆向与Frida动态调试,拆解了waimai_sign的RSA签名逻辑与mtgsig的复杂参数组装加密流程,并提供了Python模拟实现的框架与调试心得,为安全研究及合规数据分析提供实战指南。

weixin_29327525的博客 1295

Ext.form.ComboBox使用方法介绍和级联使用

Ext.form.ComboBox 属性详解(见注释)及使用方法 定义一个ComboBox:   Wayfoon.YearComb = new Ext.form.ComboBox({     id:'cbid',     name:'year',//name只是改下拉的名称     hiddenName:'hyear',//提交到后台的input的name     w

ghjzzhg的博客 1412

深入解析SOC芯片设计中DFT OCC与ATPG的协同优化策略

本文深入探讨了在复杂SOC芯片设计中,DFT(可测试性设计)的核心组件OCC(片上时钟控制器)与ATPG(自动测试向量生成)的协同优化策略。文章从基本原理出发,分析了OCC作为测试时钟管理者的关键作用,以及ATPG作为故障检测引擎的工作机制,并重点阐述了二者在测试架构选择、参数对齐、低功耗测试等场景下的协同方法与实战技巧,旨在实现更高的测试覆盖率与更低的测试成本。

efc123456的博客 1040

真格量化-bs套利

#!/usr/bin/env python # coding:utf-8 from PoboAPI import * import datetime import time import numpy as np from copy import * #开始时间,用于初始化一些参数 def OnStart(context) : context.myacc = None #登录交易账号 if context.accounts["回测期权"].Login() : co.

qq_26742269的博客 1324

ExtJS学习笔记(3)- Form元素Combo的用法

深入解析表单元素中ComboBox组件的使用。会涉及 到.net简单服务器数据交互,但暂不做深入讨论,以后会详细分析服务器交互相关,不过可能要等较长一段时间,呵呵! 5.服务器数据作为ComboBox的数据源实例 首先从服务器获取json数据: //cs后台代码,简单起见,示例而已,要主要字符串格式(新手注意,下面的代码放在类里面,不是放在方法里) publicstringServ...

weixin_30500663的博客 111

使用AI预测彩票的架构思路

彩票是随机的数字游戏,不要过度依赖AI,本文仅供娱乐研究

14 年后端老兵,专注工程实战与银河麒麟信创运维。把每个真实生产事故,拆成能复现、能上线的保姆级教程。代码开源,评论区一起排错。 9439

Ext JS 学习(6) Ext.FormPanel 组件的使用第三式(Combo的使用)

 今天我们接着深入解析表单元素中ComboBox组件的使用。会涉及到.net简单服务器数据交互,但暂不做深入讨论,以后会详细分析服务器交互相关,不过可能要等较长一段时间,呵呵!5.服务器数据作为ComboBox的数据源实例首先从服务器获取json数据://cs后台代码,简单起见,示例而已,要主要字符串格式(新手注意,下面的代码放在类里面,不是放在方法里)public string  Ser

lvjian700的博客 2678

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

ExtJs2.0学习系列(6)--Ext.FormPanel之第三式(ComboBox篇)

<br />前言:说句实话,此extjs系列的文章在博客园中的热度不高,可能是学这玩意的人不多吧,但是我觉得有这么个系列的文章对于中国朋友非常有帮助!请大家支持!<br />上篇ExtJs2.0学习系列(5)--Ext.FormPanel之第二式中我们讨论了下fieldset和表单验证的知识,今天我们接着深入解析表单元素中ComboBox组件的使用。会涉及<br />到.net简单服务器数据交互,但暂不做深入讨论,以后会详细分析服务器交互相关,不过可能要等较长一段时间,呵呵!<br />5.服务器数据作为C

chengli42的专栏 653

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: Ext.FormPanel 提交和 Ext.Ajax.request 异步提交函数的区别
下一篇: ExtJS Combobox 如何设置默认和取值问题
JavaAlpha
博客等级 码龄18年 910粉丝 511原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址