473,396 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

trying to select combobox's item with onclick instead dbclick [Extjs]

i'm trying to select my combobox items with only one click, but, when clicked once, this doesn't works, just when i click two times this has been selected, but i don't need that. But, here's an interesting (weird) thing, sometimes works with one click and other times with the double click.

here's my code:

Expand|Select|Wrap|Line Numbers
  1. items: [{
  2.     xtype: 'combo',
  3.     anchor: '100%',
  4.     padding: 10,
  5.     fieldLabel: 'Type',
  6.     name: 'fieldType',
  7.     labelStyle: "font-weight:bold;",
  8.     store: new Ext.data.Store({
  9.         fields: [{
  10.             name: 'description',
  11.             type: 'string'
  12.         }, {
  13.             name: 'name',
  14.             type: 'string'
  15.         }, {
  16.             name: 'uuid',
  17.             type: 'string'
  18.         }],
  19.         autoLoad: true,
  20.         hideTrigger: true,
  21.         minChars: 1,
  22.         triggerAction: 'query',
  23.         typeAhead: true,
  24.         proxy: {
  25.             type: 'ajax',
  26.             url: "../",
  27.             extraParams: {
  28.                 action: "catalog",
  29.                 catalog: "fieldtypeoptions",
  30.                 params: JSON.stringify({
  31.                     uuidToken: Ext.connectionToken
  32.                 })
  33.             },
  34.             reader: {
  35.                 type: 'json',
  36.                 root: 'dataTypesList'
  37.             },
  38.             listeners: {
  39.                 exception: function(proxy, response, operation, eOpts) {
  40.                     var responseArray = JSON.parse(response.responseText);
  41.                     Ext.Notify.msg(responseArray.message, {
  42.                         layout: "bottomright",
  43.                         delay: 5000,
  44.                         type: "error"
  45.                     });
  46.                 }
  47.             },
  48.         }
  49.     }),
  50.     typeAhead: true,
  51.     triggerAction: 'all',
  52.     valueField: 'uuid',
  53.     displayField: 'description',
  54.     listeners: {
  55.         change: function(combo, value) {
  56.             console.log(value);
  57.             console.log(combo);
  58.             console.log(combo.getValue());
  59.         },
  60.         click: function() {
  61.             alert('One click event');
  62.         }
  63.     },
  64.     element: 'combo'
  65. }, {
  66.     xtype: 'fieldcontainer',
  67.     anchor: "100%",
  68.     layout: 'hbox',
  69.     padding: 10,
  70.     fieldDefaults: {
  71.         msgTarget: 'under',
  72.         labelAlign: 'top'
  73.     },
  74.     items: [{
  75.         xtype: 'numberfield',
  76.         minValue: 0,
  77.         maxValue: 100,
  78.         emptyText: 'Length',
  79.         name: 'length',
  80.         allowBlank: false,
  81.         flex: 1,
  82.         listeners: {
  83.             afterrender: function(field) {
  84.                 Ext.create('Ext.tip.ToolTip', {
  85.                     target: field.getId(),
  86.                     html: 'Length'
  87.                 });
  88.             }
  89.         }
  90.     }, {
  91.         xtype: 'numberfield',
  92.         emptyText: 'Decimal',
  93.         name: 'decimal',
  94.         minValue: 0,
  95.         allowBlank: false,
  96.         maxValue: 100,
  97.         flex: 1,
  98.         listeners: {
  99.             afterrender: function(field) {
  100.                 Ext.create('Ext.tip.ToolTip', {
  101.                     target: field.getId(),
  102.                     html: 'Decimal'
  103.                 });
  104.             }
  105.         }
  106.     }]
  107. }]
  108.  
  109.  
  110. i'm trying to select my combobox items with only one click, but, when clicked once, this doesn't works, just when i click two times this has been selected, but i don't need that. But, here's an interesting (weird) thing, sometimes works with one click and other times with the double click.
  111.  
  112. here's my code:
  113.  
  114.     items: [{
  115.     xtype: 'combo',
  116.     anchor: '100%',
  117.     padding: 10,
  118.     fieldLabel: 'Type',
  119.     name: 'fieldType',
  120.     labelStyle: "font-weight:bold;",
  121.     store: new Ext.data.Store({
  122.         fields: [{
  123.             name: 'description',
  124.             type: 'string'
  125.         }, {
  126.             name: 'name',
  127.             type: 'string'
  128.         }, {
  129.             name: 'uuid',
  130.             type: 'string'
  131.         }],
  132.         autoLoad: true,
  133.         hideTrigger: true,
  134.         minChars: 1,
  135.         triggerAction: 'query',
  136.         typeAhead: true,
  137.         proxy: {
  138.             type: 'ajax',
  139.             url: "../",
  140.             extraParams: {
  141.                 action: "catalog",
  142.                 catalog: "fieldtypeoptions",
  143.                 params: JSON.stringify({
  144.                     uuidToken: Ext.connectionToken
  145.                 })
  146.             },
  147.             reader: {
  148.                 type: 'json',
  149.                 root: 'dataTypesList'
  150.             },
  151.             listeners: {
  152.                 exception: function(proxy, response, operation, eOpts) {
  153.                     var responseArray = JSON.parse(response.responseText);
  154.                     Ext.Notify.msg(responseArray.message, {
  155.                         layout: "bottomright",
  156.                         delay: 5000,
  157.                         type: "error"
  158.                     });
  159.                 }
  160.             },
  161.         }
  162.     }),
  163.     typeAhead: true,
  164.     triggerAction: 'all',
  165.     valueField: 'uuid',
  166.     displayField: 'description',
  167.     listeners: {
  168.         change: function(combo, value) {
  169.             console.log(value);
  170.             console.log(combo);
  171.             console.log(combo.getValue());
  172.         },
  173.         click: function() {
  174.             alert('One click event');
  175.         }
  176.     },
  177.     element: 'combo'
  178. }, {
  179.     xtype: 'fieldcontainer',
  180.     anchor: "100%",
  181.     layout: 'hbox',
  182.     padding: 10,
  183.     fieldDefaults: {
  184.         msgTarget: 'under',
  185.         labelAlign: 'top'
  186.     },
  187.     items: [{
  188.         xtype: 'numberfield',
  189.         minValue: 0,
  190.         maxValue: 100,
  191.         emptyText: 'Length',
  192.         name: 'length',
  193.         allowBlank: false,
  194.         flex: 1,
  195.         listeners: {
  196.             afterrender: function(field) {
  197.                 Ext.create('Ext.tip.ToolTip', {
  198.                     target: field.getId(),
  199.                     html: 'Length'
  200.                 });
  201.             }
  202.         }
  203.     }, {
  204.         xtype: 'numberfield',
  205.         emptyText: 'Decimal',
  206.         name: 'decimal',
  207.         minValue: 0,
  208.         allowBlank: false,
  209.         maxValue: 100,
  210.         flex: 1,
  211.         listeners: {
  212.             afterrender: function(field) {
  213.                 Ext.create('Ext.tip.ToolTip', {
  214.                     target: field.getId(),
  215.                     html: 'Decimal'
  216.                 });
  217.             }
  218.         }
  219.     }]
  220. }]
  221.  
I'm a little newbie with extjs, so, i just don't know for what reason this is happening... so, if anyone can help me with this, i'll be very grateful!
Mar 28 '16 #1
0 3388

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: passion_to_be_free | last post by:
This is probably simple, but I can't seem to find it anywhere. I have have some values stored in javascript variables. I have a <select> dropdown list whose options correspond to these values. I...
1
by: seansan | last post by:
Hi, I ahve an issue that I could tackle myself. sometimes a dropdown box is filled with only one element. How can I set this dropdown box to auto-select this one option? So in VB. If my...
6
by: Dan Bass | last post by:
If you look at explorer, right clicking on a file, first selects the file, then throws up the context menu relating to that selection. With a Windows ListBox control and a simple context menu,...
0
by: CDARS | last post by:
Dear all, I understand that I can bind a DataSet to a RadioButtonList control with properties DataTextField and DataValueField. ASP.NET will have the ListItem objects generated. Nice. Well...
3
by: RockNRoll | last post by:
Greetings, Can I select an item in a listbox based on user textbox entry and a submit button? Can you provide any code examples for what needs to occur when the user clicks submit? Thank you,...
1
by: John | last post by:
Hi, First off .. I am very new to ASP.NET (.NET in general), so this may be a very basic question. I want the user to click anywhere on a row to select an item. I have seen samples where I...
3
by: Lars E. Nes | last post by:
Hi all. I would like to automaticly select a item in a datagridview using the value of column. I do not have the index. Just the value (which is a string). How can this be done? Thanks.
7
by: Rotsey | last post by:
Hi, I am having a problem trying to select an item with the enter key. I want to work the combo with the keyboard. So when I use the down arrow to browse the list I want to then hit the...
1
by: Romeu Januario | last post by:
Hi everyone, how can i select an item from a directory and export the full name of it (for example test.txt) to an variable the code on the dir list that i have is: <?php $show_path = 1; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.