Dynamic add Checkbox to 2-columns Grid now not work

Dynamic add Checkbox to 2-columns Grid now not work

Hello,

I try to load a xml and add a checkbox into the 2-columns grid, but it always shows one column.
Please help!

the following Javascript function is to process the xml file where the "data" is a xml document.



  1. <fieldset id="studentList" class="ui-grid-a"></fieldset>



  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <students>

  3. <student id="" no="1" name="Eric"/>
  4. <student id="" no="2" name="Ericsson"/>

  5. </students>



  1. function processingData(data) {
  2. $('#list').empty();
  3. var output = [];
  4. var n = 1;
  5. $(data).find('student').each(function(){
  6.  
  7. var $student = $(this); 
  8.          
  9. var id = $student.attr("id");
  10. var no = $student.attr("no");
  11. var name = $student.attr("name");

  12. var block = 'a';
  13. if (n % 2 == 0) {
  14. block = 'a';
  15. } else {
  16. block = 'b';
  17. }
  18. n++;
  19.        
  20.         var html = '<div class="ui-block-' + block + '"><label for="grid-checkbox-' + no + '">' + name + '</label><input type="checkbox" id="grid-checkbox-' + no + '" name="grid-checkbox-' + no + '"></div>';

  21.         output.push(html);
  22.         
  23. });

  24.     
  25.     $('#studentList').append(output.join(''));
  26.     $('#studentList').trigger('create');
  27. }



The above is the final layout. It only showsIn fact, I want a 2-columns grid! Please tell me what I is my mistake!

Best regards,
Eric