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.
- <fieldset id="studentList" class="ui-grid-a"></fieldset>
- <?xml version="1.0" encoding="UTF-8"?>
- <students>
- <student id="" no="1" name="Eric"/>
- <student id="" no="2" name="Ericsson"/>
- </students>
- function processingData(data) {
- $('#list').empty();
-
-
- var output = [];
-
- var n = 1;
-
- $(data).find('student').each(function(){
-
- var $student = $(this);
-
- var id = $student.attr("id");
- var no = $student.attr("no");
- var name = $student.attr("name");
-
- var block = 'a';
- if (n % 2 == 0) {
- block = 'a';
- } else {
- block = 'b';
- }
-
- n++;
-
- 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>';
- output.push(html);
-
- });
-
- $('#studentList').append(output.join(''));
- $('#studentList').trigger('create');
- }
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