Results 1 to 2 of 2

Thread: Grid: adding fields to XMLDataModel onLoad

  1. #1
    Ext User
    Join Date
    Mar 2007
    Vote Rating

    Default 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 Id 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!

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    New York, NY
    Vote Rating


    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:
    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 
, 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts