By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,913 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,913 IT Pros & Developers. It's quick & easy.

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

P: 1
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
Share this question for a faster answer!
Share on Google+

Post your reply

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