Hybrid View

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    10
    Vote Rating
    0
    SenthilMahalingam is on a distinguished road

      0  

    Exclamation How to add the Dirty cell icon(red triangle) manually in the editor grid ?

    How to add the Dirty cell icon(red triangle) manually in the editor grid ?


    I am having a dirty cell in the grid(com.extjs.gxt.ui.client.event.GridEvent) which shows up with a red triangle icon.

    But when I refresh the grid (grid.getView().refresh(true)) or when I commit the record(grid.getStore().getRecord(selectedItem).commit(true)), the red icon vanishes.

    So, how do I manually place the red icon in the cell.

  2. #2
    Sencha User chalu's Avatar
    Join Date
    Feb 2008
    Location
    Benin City, Nigeria
    Posts
    480
    Vote Rating
    1
    chalu is on a distinguished road

      0  

    Default


    Of course did red marker should disappear after you commit the record changes in the store. The red marker is placed automatically in dirty cell in editable grids so why do you want to do it manually.
    Anyways u can add the ".x-grid3-dirty-cell" css class to the cell you are interested in, never tried it but it make work.

  3. #3
    Sencha User
    Join Date
    Apr 2011
    Posts
    10
    Vote Rating
    0
    SenthilMahalingam is on a distinguished road

      0  

    Default


    Hey, Thanks for your reply.

    I taught of that option, but I don't know how to add the "x-grid3-dirty-cell" style to one particular cell.

    grid.getView().getCell(1, 6).setClassName("x-grid3-dirty-cell"); doesn't work.

    Answering your question why I am doing it manually, there is logic in my module to refresh certain cells not rows.So I have to commit the records for doing it,but while committing the red icon vanishes.

    Can you help me on this.

  4. #4
    Sencha User
    Join Date
    Oct 2010
    Posts
    129
    Vote Rating
    0
    blay is on a distinguished road

      0  

    Default


    You have to 'play' with methods (setDirty) of the record associated to the model.

    You can get that record by:

    Code:
    store.getRecord(model)

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    10
    Vote Rating
    0
    SenthilMahalingam is on a distinguished road

      0  

    Default


    After I used setDirty, I have to refresh or commit,in both the cases it'll remove the red icon.

  6. #6
    Sencha User
    Join Date
    Mar 2011
    Posts
    79
    Vote Rating
    0
    vtysh is on a distinguished road

      0  

    Default


    Actually setDirty will not help such as inside set method of Record class there is a check whether value was changed or no. To achieve what you need i overrode Record class and added ignoreEqualsCheck parameter to set method. So i got next code in Record class
    Code:
    /**
       * Set the named field to the specified value.
       * 
       * @param name the name of the field to set
       * @param value the value of the field to set
       */
      public void set(String name, Object value) {
    	  set(name,value,false);
      }
      /**
       * Set the named field to the specified value.
       * 
       * @param name the name of the field to set
       * @param value the value of the field to set
       * @param ignoreEqualsCheck whether or not check previous value to mark dirty cells
       */
      public void set(String name, Object value, boolean ignoreEqualsCheck) {
    	  Object o = model.get(name);
    	  if (!ignoreEqualsCheck&&Util.equalWithNull(o, value)) {
    		  return;
    	  }
    	  dirty = true;
    	  hasChange = true;
    	  if (modified == null) {
    		  modified = new RpcMap();
    	  }
    
    	  if (!modified.containsKey(name)) {
    		  modified.put(name, o);
    	  } else {
    		  Object origValue = modified.get(name);
    		  if (!ignoreEqualsCheck&&Util.equalWithNull(origValue, value)) {
    			  modified.remove(name);
    			  if (modified.size() == 0) {
    				  dirty = false;
    			  }
    			  if (validMap != null) {
    				  validMap.remove(name);
    			  }
    		  }
    	  }
    
    	  model.set(name, value);
    
    	  if (!editing && store != null) {
    		  store.afterEdit(this);
    	  }
      }
    Then in my client code to mark grid cell as dirty even without actual value changing i use next approach

    Code:
    Record r=store.getRecord(store.getAt(i));
    r.beginEdit();
    Object val=r.get(col);
    r.set(col,val,true);
    r.endEdit();
    I think there should be better approaches. But this one works also.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi