Announcement

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

    #16
    How can I add parameters to Criteria. addCriteria() method doesn't help? For instance, criteria3.addCriteria("chargr_id", chargr_id);
    Code:
    final ListGrid listGridInner = new ListGrid();
    listGridInner.setDataSource(DataSource.get("fillPropertObj"));
    listGridInner.setWidth("50%");
    listGridInner.setHeight(340);
    listGridInner.setAlternateRecordStyles(true);						
    ListGridField gritem_name = new ListGridField("gritem_name");
    final ListGridField value = new ListGridField("value");						
    listGridInner.setFields(gritem_name, value);							
    String obj_base = event.getLeaf().getAttribute("obj_base");
    final Criteria criteria2 = new Criteria();
    criteria2.addCriteria("obj_base", obj_base);
    listGridInner.setFetchOperation("FillPropertObj1");
    listGridInner.fetchData(criteria2);								
    listGridInner.addRecordClickHandler(new RecordClickHandler() {
    public void onRecordClick(RecordClickEvent event) {	
    Record record = new Record();
    record = event.getRecord();
    final String chargr_id = record.getAttribute("chargr_id");
    final String gritem_id = record.getAttribute("gritem_id");
    final String obj = record.getAttribute("obj");
    final String str = record.getAttribute("typpropert");
    Criteria criteria3 = new Criteria();
    criteria3.addCriteria("chargr_id", chargr_id);
    criteria3.addCriteria("gritem_id", gritem_id);
    criteria3.addCriteria("obj", obj);								
    if (!str.equals("4") && !"5".equals(str)) {
    	value.setCanEdit(true);									
    	listGridInner.setEditEvent(ListGridEditEvent.CLICK);									
    	value.addCellSavedHandler(new CellSavedHandler() {
    		public void onCellSaved(CellSavedEvent event) {
    			Record record2 = new Record();
    			record2 = event.getRecord();																										
    			if (str.equals("1")) {
    				listGridInner.setUpdateOperation("ObjUpdAttrib");
    				//listGridInner.updateData(record);
    				listGridInner.updateData(record2);
    			} else if (str.equals("2")) {
    				listGridInner.setFetchOperation("ObjListFactor");
    				listGridInner.setUpdateOperation("ObjUpdFactor");
    			} else if (str.equals("3")) {												
    				listGridInner.setUpdateOperation("ObjUpdMeter");
    			}											
    		}
    	});									
    } else {
    	value.setCanEdit(false);
    }
    }
    });
    Attached Files
    Last edited by b.kazybaev; 29 Jan 2013, 20:53.

    Comment


      #17
      If you reset your log settings to the default that comes with the SDK, you won't have these massive log files, which are difficult to read (for both you and for us).

      The logs show that your additional criteria don't get to the server.

      This is not surprising since your code creates a Criteria object ("criteria3") then appears to do nothing with it..

      Comment


        #18
        So, how can I reset log settings to default?
        And how can I get criteria on a server side without using fetchData()? Is there any other methods to pass old values of clicked record to *.ds.xml?

        Comment


          #19
          See the installation instructions - we provide a log4j settings file and explain where it should be placed.

          Your second question didn't make much sense to us, but:

          - the server-side APIs of dsRequest provide several ways of accessing inbound criteria
          - When dataBoundComponents save (eg listGrid inline editing, df.saveData()) they automatically provide dsRequest.oldValues

          Comment


            #20
            I reset my log setting to default.

            There are some problems with update operation. Could you provide us with some examples on updating record, on calling stored procedure which updates table in a MS SQL database?
            Here is a snippet of code:
            Code:
            treeGrid.addLeafClickHandler(new LeafClickHandler() {
            	public void onLeafClick(LeafClickEvent event) {												
            		final ListGrid listGridInner = new ListGrid();
            		listGridInner.setDataSource(DataSource.get("fillPropertObj"));
            		listGridInner.setWidth("50%");
            		listGridInner.setHeight(340);
            		listGridInner.setAlternateRecordStyles(true);						
            		ListGridField gritem_name = new ListGridField("gritem_name");
            		final ListGridField value = new ListGridField("value");						
            		listGridInner.setFields(gritem_name, value);							
            		String obj_base = event.getLeaf().getAttribute("obj_base");
            		final Criteria criteria2 = new Criteria();
            		criteria2.addCriteria("obj_base", obj_base);
            		listGridInner.setFetchOperation("FillPropertObj1");
            		listGridInner.fetchData(criteria2);								
            		listGridInner.addRecordClickHandler(new RecordClickHandler() {
            			public void onRecordClick(RecordClickEvent event) {
            				Record record = new Record();
            				record = event.getRecord();
            				final String str = record.getAttribute("typpropert");
            				if (!str.equals("4") && !"5".equals(str)) {
            					value.setCanEdit(true);									
            					listGridInner.setEditEvent(ListGridEditEvent.CLICK);									
            				} else {
            					value.setCanEdit(false);
            				}
            			}
            		});
            		VLayout layoutRight2 = new VLayout();
            		layoutRight2.setLeft("52%");		        
            		layoutRight2.setTop(450);        
            		layoutRight2.setWidth("93%");
            		layoutRight2.setHeight(340);																	
            		layoutRight2.addMember(listGridInner);				
            		layoutRight2.draw();							
            	}
            });
            Attached Files

            Comment


              #21
              We don't maintain samples of MSSQL stored procedures.

              This is an issue with your stored procedure returning something inappropriate for an update operation. We are just using JDBC standard PreparedStatement.executeUpdate() as you would expect, but MS' JDBC driver considers your procedure call invalid in that context.

              Comment

              Working...
              X