0 Replies Latest reply on Aug 13, 2007 1:24 PM by Rusty_B

    DataGrid MultiLineCell Example Using XML?

    Rusty_B Level 1
      I found the example in the documentation, which uses hard coded examples. I need a version of this that is loading the data with xml. Anyone have any ideas?

      Using hard-coded values:
      myDP = new Array();
      var aLongString:String = " An example of a cell renderer class that displays a multiple line TextField"
      myDP.addItem({firstName:"Winston", lastName:"Elstad", note:aLongString, item:100});
      myDP.addItem({firstName:"Ric", lastName:"Dietrich", note:aLongString, item:101});
      myDP.addItem({firstName:"Ewing", lastName:"Canepa", note:aLongString, item:102});
      myDP.addItem({firstName:"Kevin", lastName:"Wade", note:aLongString, item:103});
      myDP.addItem({firstName:"Kimberly", lastName:"Dietrich", note:aLongString, item:104});
      myDP.addItem({firstName:"AJ", lastName:"Bilow", note:aLongString, item:105});
      myDP.addItem({firstName:"Chuck", lastName:"Yushan", note:aLongString, item:106});
      myDP.addItem({firstName:"John", lastName:"Roo", note:aLongString, item:107});

      // Assign cellRenderers.
      myGrid_dg.getColumnAt(2).cellRenderer = "MultiLineCell";

      My datagrid is using the following xml code to load:
      var myXML:XML = new XML();
      myXML.ignoreWhite = true;
      myXML.onLoad = handleXML;

      function handleXML(pSuccess:Boolean):Void {
      if(pSuccess) {
      var dp:Array = new Array();
      var recordNode:XMLNode = myXML.firstChild;
      var detailNodes:Array = recordNode.childNodes;
      var detailLength:Number = detailNodes.length;

      for(var i:Number = 0; i < detailLength; i++) {
      var detailNode:XMLNode = detailNodes ;
      var detailNodeArray:Array = detailNode.childNodes;
      var detailNodeLength:Number = detailNodeArray.length;

      var obj:Object = new Object();

      for(var j:Number = 0; j < detailNodeLength; j++) {
      var node:XMLNode = detailNodeArray[j];

      if(node.nodeName == "ab_refnum")
      obj["Ref. No."] = node.firstChild.nodeValue;
      else if(node.nodeName == "document_num")
      obj["Patent/Application No."] = node.firstChild.nodeValue;
      else if(node.nodeName == "claim_category")
      obj["Claim Category"] = node.firstChild.nodeValue;
      else if(node.nodeName == "description")
      obj["Description"] = node.firstChild.nodeValue;