1 Reply Latest reply on Oct 27, 2006 10:52 AM by TimSymons

    DataGrid Column Format Issue HELP PLEASE!!!

      I have been trying to create a test result page that will display the question as well as the correct answer. I have gathered the data and output it to an xml file and it is working fine. The problem is that the question as well as the correct answer that appear in the third column is longer that the column width. I have searched and searched but haven't been able to figure how to format that column to allow for word wrapping or multilines.

      I am so close to success, but just can't figure how to format the column in the DataGrid. Here is the code I am using:

      //get list of questions//
      var p = _root.xCurrentItem.parentNode.parentNode;
      questions = p.selectNodes ("/descendant-or-self::item[@type='Question-Test']");
      //loop through questions and get question node at question_id//
      for (var i = 0; i < questions.length; i++)
      question_id = questions .attributes.question_id;
      var qScore
      qScore = questions
      _xmlq = _xml.selectSingleNode ("//questions/question[@id='" + question_id + "']");
      //get the question data//
      _xmldata = new XML (_xmlq.attributes.data);
      stem = _xmldata.selectSingleNode ("//question").attributes.value;
      //get the correct answer and set the value to cAnswer//
      var choice = _xmldata.selectNodes ("//choice");
      if (choice.length > 0)
      for (var j = 0; j < choice.length; j++)
      if (choice[j].attributes.target == 1)
      cAnswer = choice[j].attributes.value;
      o = new Object ();
      o.colNum = i + 1;
      o.colScore = qScore;
      o.colStem = stem;
      mcDataGrid.addItem (o);
      p = new Object ();
      p.colStem = cAnswer;
      mcDataGrid.addItem (p);
      mcDataGrid._visible = true;
      GetParentData ();

      The other issue, although small, is that I have been trying to change the boolean value of the score from 0 and 1 to P and F. Not a big deal, but if you can figure that out it will help. Text
        • 1. Re: DataGrid Column Format Issue HELP PLEASE!!!
          TimSymons Level 1
          You cannot just set the DataGrid to wordwrap. To get text to wrap within a cell of a Datagrid component you have to create your own cell rendering class. If you look in the Help files under CellRender, one of the examples they use is getting text to wrap within a cell. So you can just follow the example to get what you need for your program.