Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Combobox and OptionDataSource (How to make it work ?)

    Hi all,
    Env :
    1.GWT Version : 2.3.0
    2.SGWT Version : SmartGWT 2.5 EE (Eval) build - 15.06.2011
    3.OS : Ubuntu 9.10
    4.Browser : Firefox 3.5.8 (Also I tried on Firefox 5.0 : result is the same).
    5.DB Version : Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production

    I'm trying to make comboboxitem with optiondatasource work normally for three weeks but no success :(.

    here is a simplest example about this :

    1. Server side datasource XML file (SQLDatasource) :

    Code:
    <DataSource
    	ID="FirstNameDS"
    	serverType="sql"
    	tableName="info.firstnames"
    	qualifyColumnNames="false">
    	<fields>
    		<field name="firstname_Id"		type="integer"	title="ID"	hidden="true" primaryKey="true" />
    		<field name="firstname"			type="text" 	title="Firstname"/>		
    	</fields>
    	
    	<operationBindings>
    		<operationBinding operationId="searchFromDBCustomForCombos" operationType="fetch">
        		<selectClause>   			
        			t.firstname_Id,
        			t.firstname
    			</selectClause> 
    			<tableClause>firstnames t</tableClause>
    			<whereClause><![CDATA[ 
    				t.deleted = 0
    				#if($criteria.firstname) AND t.firstname like ($criteria.firstname)||'%' #end
    				]]>  
    			</whereClause> 
        	</operationBinding>
        </operationBindings>	
    </DataSource>
    2. and the client code :
    Code:
    public class CallCenter implements EntryPoint {
    	public void onModuleLoad() {
    		try {
    			// form 
    			DynamicForm form = new DynamicForm();
    			form.setPadding(10);
    			form.setAutoFocus(true);
    			form.setWidth100();
    			form.setTitleWidth(80);
    			form.setNumCols(2);
    			form.setTitleOrientation(TitleOrientation.TOP);
    
    			// comboboxitem
    			final ComboBoxItem firstNameItem = new ComboBoxItem();
    			// title for this comboboxitem
    			firstNameItem.setTitle("სახელი");
    			firstNameItem.setName("firstname_Id");
    			firstNameItem.setWidth(270);
    			firstNameItem.setFetchMissingValues(true);
    			firstNameItem.setFilterLocally(true);
    			firstNameItem.setAddUnknownValues(false);
    			
    			// datasource
    			DataSource firstNamesDS = DataSource.get("FirstNameDS");
    			
    			// fetch name
    			firstNameItem.setOptionOperationId("searchFromDBCustomForCombos");
    			firstNameItem.setOptionDataSource(firstNamesDS);
    			firstNameItem.setValueField("firstname_Id");
    			firstNameItem.setDisplayField("firstname");
    			
    			Criteria criteria = new Criteria();
    			firstNameItem.setOptionCriteria(criteria);
    			firstNameItem.setAutoFetchData(true);
    
    			DSRequest dsRequest = new DSRequest();
    			dsRequest.setOperationId("searchFromDBCustomForCombos");
    
    			firstNamesDS.fetchData(criteria, new DSCallback() {
    				@Override
    				public void execute(DSResponse response, Object rawData,
    						DSRequest request) {
    					// this works sometimes !!!!!!!!!!!!!!!!!
    					firstNameItem.setValue(9114);
    				}
    			}, dsRequest);
    			form.setFields(firstNameItem);
    			RootPanel.get().add(form);			
    		} catch (Exception e) {
    			e.printStackTrace();
    			SC.say(e.toString());
    		}
    	}
    }
    3. Server side Logs (When not working):
    Code:
    === 2011-06-30 22:58:18,117 [0-36] INFO  RequestContext - URL: '/CallCenter.html', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,118 [0-36] INFO  Compression - /CallCenter.html: 1302 -> 505 bytes
    === 2011-06-30 22:58:18,129 [0-36] INFO  RequestContext - URL: '/CallCenter.css', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,129 [0-36] INFO  Compression - /CallCenter.css: 341 -> 225 bytes
    === 2011-06-30 22:58:18,133 [0-37] INFO  RequestContext - URL: '/callcenter/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,133 [0-35] INFO  RequestContext - URL: '/callcenter/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,133 [0-26] INFO  RequestContext - URL: '/callcenter/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,138 [0-33] INFO  RequestContext - URL: '/callcenter/sc/DataSourceLoader', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,148 [0-36] INFO  RequestContext - URL: '/callcenter/callcenter.nocache.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,149 [0-36] INFO  Compression - /callcenter/callcenter.nocache.js: 8409 -> 2749 bytes
    === 2011-06-30 22:58:18,157 [0-36] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_Core.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,220 [0-36] INFO  Compression - /callcenter/sc/modules/ISC_Core.js: 687348 -> 178147 bytes
    === 2011-06-30 22:58:18,412 [0-36] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_Foundation.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,430 [0-36] INFO  Compression - /callcenter/sc/modules/ISC_Foundation.js: 222082 -> 52811 bytes
    === 2011-06-30 22:58:18,432 [0-35] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_Forms.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,432 [0-26] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_Grids.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,432 [0-32] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_RichTextEditor.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,434 [0-37] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_Containers.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,436 [0-32] INFO  Compression - /callcenter/sc/modules/ISC_RichTextEditor.js: 40251 -> 11207 bytes
    === 2011-06-30 22:58:18,443 [0-37] INFO  Compression - /callcenter/sc/modules/ISC_Containers.js: 116844 -> 28255 bytes
    === 2011-06-30 22:58:18,451 [0-33] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_Calendar.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,459 [0-33] INFO  Compression - /callcenter/sc/modules/ISC_Calendar.js: 103425 -> 24884 bytes
    === 2011-06-30 22:58:18,462 [0-36] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_RealtimeMessaging.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,463 [0-36] INFO  Compression - /callcenter/sc/modules/ISC_RealtimeMessaging.js: 9049 -> 2776 bytes
    === 2011-06-30 22:58:18,464 [0-33] INFO  RequestContext - URL: '/callcenter/sc/modules/ISC_DataBinding.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,472 [0-32] INFO  RequestContext - URL: '/callcenter/sc/skins/Enterprise/load_skin.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,473 [0-32] INFO  Download - done streaming: /home/kakha/workspaceEclipse/CallCenter/war/callcenter/sc/skins/Enterprise/load_skin.js
    === 2011-06-30 22:58:18,475 [0-32] INFO  Compression - /callcenter/sc/skins/Enterprise/load_skin.js: 29924 -> 6382 bytes
    === 2011-06-30 22:58:18,487 [0-37] INFO  RequestContext - URL: '/callcenter/sc/initsc.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,487 [0-37] INFO  Compression - /callcenter/sc/initsc.js: 47 -> 72 bytes
    === 2011-06-30 22:58:18,495 [0-37] INFO  RequestContext - URL: '/callcenter/sc/skins/EnterpriseBlue/load_skin.js', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:18,496 [0-37] INFO  Download - done streaming: /home/kakha/workspaceEclipse/CallCenter/war/callcenter/sc/skins/EnterpriseBlue/load_skin.js
    === 2011-06-30 22:58:18,497 [0-35] INFO  Compression - /callcenter/sc/modules/ISC_Forms.js: 587147 -> 143388 bytes
    === 2011-06-30 22:58:18,497 [0-37] INFO  Compression - /callcenter/sc/skins/EnterpriseBlue/load_skin.js: 29961 -> 6373 bytes
    === 2011-06-30 22:58:18,567 [0-26] INFO  Compression - /callcenter/sc/modules/ISC_Grids.js: 718368 -> 180911 bytes
    === 2011-06-30 22:58:18,584 [0-33] INFO  Compression - /callcenter/sc/modules/ISC_DataBinding.js: 513027 -> 127563 bytes
    === 2011-06-30 22:58:19,075 [0-26] INFO  RequestContext - URL: '/callcenter/sc/skins/Enterprise/skin_styles.css', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:19,076 [0-26] INFO  Download - done streaming: /home/kakha/workspaceEclipse/CallCenter/war/callcenter/sc/skins/Enterprise/skin_styles.css
    === 2011-06-30 22:58:19,078 [0-26] INFO  Compression - /callcenter/sc/skins/Enterprise/skin_styles.css: 61169 -> 8018 bytes
    === 2011-06-30 22:58:19,123 [0-26] INFO  RequestContext - URL: '/callcenter/sc/skins/EnterpriseBlue/skin_styles.css', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:19,124 [0-26] INFO  Download - done streaming: /home/kakha/workspaceEclipse/CallCenter/war/callcenter/sc/skins/EnterpriseBlue/skin_styles.css
    === 2011-06-30 22:58:19,126 [0-26] INFO  Compression - /callcenter/sc/skins/EnterpriseBlue/skin_styles.css: 61039 -> 8009 bytes
    === 2011-06-30 22:58:19,156 [0-26] INFO  RequestContext - URL: '/callcenter/gwt/standard/standard.css', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:19,158 [0-26] INFO  Compression - /callcenter/gwt/standard/standard.css: 26953 -> 3866 bytes
    === 2011-06-30 22:58:19,159 [0-33] INFO  RequestContext - URL: '/callcenter/custom-control-styles.css', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:19,159 [0-33] INFO  Compression - /callcenter/custom-control-styles.css: 1325 -> 661 bytes
    === 2011-06-30 22:58:21,713 [0-33] INFO  RequestContext - URL: '/callcenter/sc/skins/EnterpriseBlue/images/pickers/comboBoxPicker.png', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:21,714 [0-33] INFO  Download - done streaming: /home/kakha/workspaceEclipse/CallCenter/war/callcenter/sc/skins/EnterpriseBlue/images/pickers/comboBoxPicker.png
    === 2011-06-30 22:58:21,763 [0-35] INFO  RequestContext - URL: '/callcenter/sc/IDACall', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:21,765 [0-35] DEBUG XML - Parsed XML from (in memory stream): 1ms
    === 2011-06-30 22:58:21,767 [0-35] DEBUG RPCManager - Processing 1 requests.
    === 2011-06-30 22:58:21,767 [0-35] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
        },
        operationConfig:{
            dataSource:"FirstNameDS",
            operationType:"fetch",
            textMatchStyle:"startsWith"
        },
        componentId:"isc_PickListMenu_0",
        appID:"builtinApplication",
        operation:"searchFromDBCustomForCombos",
        oldValues:null
    }
    === 2011-06-30 22:58:21,767 [0-35] INFO  IDACall - Performing 1 operation(s)
    === 2011-06-30 22:58:21,767 [0-35] DEBUG AppBase - [builtinApplication.searchFromDBCustomForCombos] No userTypes defined, allowing anyone access to all operations for this application
    === 2011-06-30 22:58:21,767 [0-35] DEBUG AppBase - [builtinApplication.searchFromDBCustomForCombos] No public zero-argument method named '_searchFromDBCustomForCombos' found, performing generic datasource operation
    === 2011-06-30 22:58:21,767 [0-35] INFO  SQLDataSource - [builtinApplication.searchFromDBCustomForCombos] Performing fetch operation with
    	criteria: {}	values: {}
    === 2011-06-30 22:58:21,767 [0-35] INFO  SQLWhereClause - [builtinApplication.searchFromDBCustomForCombos] empty condition
    === 2011-06-30 22:58:21,768 [0-35] INFO  SQLDataSource - [builtinApplication.searchFromDBCustomForCombos] derived query: SELECT    			
        			t.firstname_Id,
        			t.firstname
    			 FROM firstnames t WHERE  
    				t.deleted = 0
    				#if($criteria.firstname) AND t.firstname like ($criteria.firstname)||'%' #end
    				  
    			
    === 2011-06-30 22:58:21,770 [0-33] INFO  RequestContext - URL: '/callcenter/sc/IDACall', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:21,772 [0-33] DEBUG XML - Parsed XML from (in memory stream): 2ms
    === 2011-06-30 22:58:21,773 [0-33] DEBUG RPCManager - Processing 1 requests.
    === 2011-06-30 22:58:21,774 [0-33] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
        },
        operationConfig:{
            dataSource:"FirstNameDS",
            operationType:"fetch"
        },
        appID:"builtinApplication",
        operation:"searchFromDBCustomForCombos",
        oldValues:{
        }
    }
    === 2011-06-30 22:58:21,774 [0-33] INFO  IDACall - Performing 1 operation(s)
    === 2011-06-30 22:58:21,774 [0-33] DEBUG AppBase - [builtinApplication.searchFromDBCustomForCombos] No userTypes defined, allowing anyone access to all operations for this application
    === 2011-06-30 22:58:21,774 [0-33] DEBUG AppBase - [builtinApplication.searchFromDBCustomForCombos] No public zero-argument method named '_searchFromDBCustomForCombos' found, performing generic datasource operation
    === 2011-06-30 22:58:21,774 [0-33] INFO  SQLDataSource - [builtinApplication.searchFromDBCustomForCombos] Performing fetch operation with
    	criteria: {}	values: {}
    === 2011-06-30 22:58:21,774 [0-33] INFO  SQLWhereClause - [builtinApplication.searchFromDBCustomForCombos] empty condition
    === 2011-06-30 22:58:21,774 [0-33] INFO  SQLDataSource - [builtinApplication.searchFromDBCustomForCombos] derived query: SELECT    			
        			t.firstname_Id,
        			t.firstname
    			 FROM firstnames t WHERE  
    				t.deleted = 0
    				#if($criteria.firstname) AND t.firstname like ($criteria.firstname)||'%' #end
    				  
    			
    === 2011-06-30 22:58:21,776 [0-26] INFO  RequestContext - URL: '/callcenter/sc/skins/EnterpriseBlue/images/blank.gif', User-Agent: 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101130 Ubuntu/9.10 (karmic) Firefox/3.5.8': Moz (Gecko) with Accept-Encoding header
    === 2011-06-30 22:58:21,777 [0-26] INFO  Download - done streaming: /home/kakha/workspaceEclipse/CallCenter/war/callcenter/sc/skins/EnterpriseBlue/images/blank.gif
    === 2011-06-30 22:58:21,818 [0-35] DEBUG PoolableSQLConnectionFactory - [builtinApplication.searchFromDBCustomForCombos] Returning pooled Connection
    === 2011-06-30 22:58:21,822 [0-33] DEBUG PoolableSQLConnectionFactory - [builtinApplication.searchFromDBCustomForCombos] Returning pooled Connection
    === 2011-06-30 22:58:21,823 [0-33] INFO  SQLDriver - [builtinApplication.searchFromDBCustomForCombos] Executing SQL query on 'Oracle': SELECT    			
        			t.firstname_Id,
        			t.firstname
    			 FROM firstnames t WHERE  
    				t.deleted = 0
    								  
    			
    === 2011-06-30 22:58:21,825 [0-35] INFO  SQLDriver - [builtinApplication.searchFromDBCustomForCombos] Executing SQL query on 'Oracle': SELECT    			
        			t.firstname_Id,
        			t.firstname
    			 FROM firstnames t WHERE  
    				t.deleted = 0
    								  
    			
    === 2011-06-30 22:58:22,108 [0-35] INFO  DSResponse - [builtinApplication.searchFromDBCustomForCombos] DSResponse: List with 7479 items
    === 2011-06-30 22:58:22,114 [0-35] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2011-06-30 22:58:22,115 [0-35] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    === 2011-06-30 22:58:22,132 [0-33] INFO  DSResponse - [builtinApplication.searchFromDBCustomForCombos] DSResponse: List with 7479 items
    === 2011-06-30 22:58:22,148 [0-33] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
    === 2011-06-30 22:58:22,149 [0-33] DEBUG RPCManager - non-DMI response, dropExtraFields: false
    === 2011-06-30 22:58:22,267 [0-35] INFO  Compression - /callcenter/sc/IDACall: 386264 -> 53113 bytes
    === 2011-06-30 22:58:22,280 [0-33] INFO  Compression - /callcenter/sc/IDACall: 386264 -> 53113 bytes
    problem is that "firstNameItem.setValue(9114);" not works every time when i refresh the page.

    Did I miss something ?

    Is there any example about ComboboxItem and OptionDatasource ?
    Also sometimes I see 9114(firstname_Id) not the description. If i click cursor into combobox and then leave the text is appeard.

    For clear explanation I'll attach images here.


    Any Ideal will be appreciated.


    Regards,
    Paata Lominadze.
    Attached Files
    Last edited by paatal; 30 Jun 2011, 11:03.

    #2
    There's an entire folder of ComboBox samples in the Showcase (what were you doing for three weeks if not looking at these??).

    Why are you using filterLocally with more than 7,000 items?

    What's the purpose of this code:

    Code:
    			firstNamesDS.fetchData(criteria, new DSCallback() {
    				@Override
    				public void execute(DSResponse response, Object rawData,
    						DSRequest request) {
    					// this works sometimes !!!!!!!!!!!!!!!!!
    					firstNameItem.setValue(9114);
    				}
    			}, dsRequest);
    It seems to fetch data and do nothing with it.

    Comment


      #3
      thank you very much Isomorphic for your quick reply.
      1. why I have this :
      Code:
      firstNameItem.setFilterLocally(true);
      without this attribute :
      Code:
      firstNameItem.setAddUnknownValues(false);
      I had an error :
      Code:
      01:14:31.718 [ERROR] [callcenter] 01:14:31.708:XRP0:WARN:fetchMissingValues:isc_ComboBoxItem_1:FetchMissingValues - filterLocally is false yet optionDataSource fetch included records that do not match our current data value. Ignoring these values.
      com.smartgwt.client.core.JsObject$SGWT_WARN: 01:14:31.708:XRP0:WARN:fetchMissingValues:isc_ComboBoxItem_1:FetchMissingValues - filterLocally is false yet optionDataSource fetch included records that do not match our current data value. Ignoring these values.
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
          at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
          at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
          at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
          at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
          at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
          at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
          at java.lang.Thread.run(Thread.java:662)

      but
      Code:
      firstNameItem.setAddUnknownValues(false);
      resolve this problem.

      OK. I will remove this :
      Code:
      firstNameItem.setFilterLocally(true);

      2. And what about this code :
      Code:
      firstNamesDS.fetchData(criteria, new DSCallback() {
      				@Override
      				public void execute(DSResponse response, Object rawData,
      						DSRequest request) {
      					// this works sometimes !!!!!!!!!!!!!!!!!
      					firstNameItem.setValue(9114);
      				}
      			}, dsRequest);
      I have customer's grid, which has firstname, lastname and other properties, after selecting record I want edit this properties.

      how I can set select firstname,lastname and other properites into ComboboxItems ?

      also I tried this code instead of above code :
      Code:
      //this is test example.
      firstNameItem.setValue(9114); 
      
      //This is real code snippet from my application.
      //firstNameItem.setValue(customersGrid.getSelectedRecord().getAttributeAsInt("firstname_Id"));

      Of course I found examples into showcase, but I can't resolve this "setValue" Problem yet.



      Regards,
      Paata Lominadze.

      Comment


        #4
        Both that warning and your general problem have the same cause: your whereClause is hardcoded to ignore any criteria but firstName, whereas fetchMissingValues requests records by primary key. When this fetch arrives, it looks like you send all records back, which is wrong.

        Comment


          #5
          ok, I made some changes :
          1. DS for dynamic where clause as described here :

          http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/docs/CustomQuerying.html

          Code:
          <operationBindings>
          		<operationBinding operationId="searchFromDBCustomForCombos" operationType="fetch">
              		<selectClause>   			
              			t.firstname_Id,
              			t.firstname
          			</selectClause> 
          			<tableClause>firstnames t</tableClause>	
          			<whereClause>($defaultWhereClause) AND t.deleted = 0</whereClause>			
              	</operationBinding>
          2. Client :
          Code:
          // comboboxitem
          			final ComboBoxItem firstNameItem = new ComboBoxItem();
          			// title for this comboboxitem
          			firstNameItem.setTitle("Firstname : ");
          			firstNameItem.setName("firstname_Id");
          			firstNameItem.setWidth(270);
          			firstNameItem.setFetchMissingValues(true);
          			firstNameItem.setFilterLocally(false);
          			firstNameItem.setAddUnknownValues(false);
          
          			// datasource
          			DataSource firstNamesDS = DataSource.get("FirstNameDS");
          
          			// fetch name
          			firstNameItem.setOptionOperationId("searchFromDBCustomForCombos");
          			firstNameItem.setOptionDataSource(firstNamesDS);
          			firstNameItem.setValueField("firstname_Id");
          			firstNameItem.setDisplayField("firstname");
          
          			Criteria criteria = new Criteria();
          			criteria.setAttribute("deleted", 0);
          
          			firstNameItem.setOptionCriteria(criteria);
          			firstNameItem.setAutoFetchData(true);
          			
          			// FOR TESTING !!!!!!!!!!!!!!!!!!!
          			firstNameItem.setValue(9114);
          Now problem is that SQL generated by the datasource returns only one item(fetchMissingValues requests records by primary key), And when typing symbols nothing happened (request is not generated), I have only 1 item to select.

          Miss I some parameters to set for datasource or comboboxitem ?

          Thank you very much again in advance.


          __________________
          Regards,
          Paata Lominadze

          Comment


            #6
            fetchMissingValues should fetch exactly one item, that's it purpose. Separately, the ComboBoxItem will issue fetches that do not contain a primary key as you type. But since you've called setValue(), this obviously only happens once the user deletes the value in the field, otherwise, there's at most one match.

            Comment


              #7
              Hi again.

              Sorry for disturbing. Can you hint any workaround for this case ?

              What is my task :
              I have customers Grid. Customer has firstname and lastname properties, both attributes are another datasources and must be selectable not enterable.

              Aso I have 2 buttons on top of grid : "New Customer" And "Edit Customer" (When selected customer into grid).
              After click this buttons Pop-up dialog is shown and I want to add or edit customers firstname and lastname.

              Any hint will be appreciated,

              Thank's In Advance.

              _____________________
              Regards,
              Paata Lominadze

              Comment

              Working...
              X