1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    1
    Vote Rating
    0
    carsten is on a distinguished road

      0  

    Default Grid: adding fields to XMLDataModel onLoad

    Grid: adding fields to XMLDataModel onLoad


    Hi there,

    first of all: thx a lot to Jack for all this awesome good work!!

    Jack, or anybody else: could U provide me with ideas / recommendation on how to - on the client side - add fields when XML data has finished loading?

    An example case: from the server I receive values for eg. loginCount and purchaseCount and have these 2 be shown as cols - now I´d like to add a 3rd column to display the 'login to purchase' percentage there.

    How do I do similar the best way? Add a preprocessor to create a new node or similar?

    Thx for any idea!
    carsten

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    Personally, I would do that at the source of the document. If you have to do it client-side, you could do it by overriding insertRows (and addRows if you use it manually, but internally the grid uses insertRows when loading the XML). You could try something like this, assuming your data model was called dataModel:

    1. Define a bogus column in your XMLDataModel schema that won't match any nodes.

    2. Override insertRows:
    Code:
    dataModel.insertRows = function(index, data){
          //data would be a multi-dimensional array of rows and column data.
          // loop through each row and set our bogus column (column 5) value
          // to the sum of column 2 and 4
          for(var i = 0, len = data.length; i < len; i++){
               var colData = data[i];
               colData[5] = colData[2] + colData[4];
          }
          // call the default insertRows 
          YAHOO.ext.grid.XMLDataModel.prototype.insertRows.call(this, index, data);
    };
    It would useful to add this functionality built in though. I can see where it would definitely be useful. I will look at adding it in a future release.

Similar Threads

  1. Copy & Paste of Rows/Fields in Grid? Is it possible?
    By Preston in forum Ext 1.x: Help & Discussion
    Replies: 9
    Last Post: 28 May 2009, 6:43 AM
  2. XMLDataModel...Adding row dynamically
    By booshan in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 27 Mar 2007, 10:36 AM
  3. XMLDataModel schema fields XPath support?
    By sjivan in forum Community Discussion
    Replies: 12
    Last Post: 16 Dec 2006, 10:00 AM
  4. Boolean Fields Not Working in Inline Editor Grid
    By kyahne in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 5 Dec 2006, 1:26 AM
  5. Grid onload???
    By galdaka in forum Ext 1.x: Help & Discussion
    Replies: 7
    Last Post: 30 Oct 2006, 11:53 AM

Thread Participants: 1

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