diff options
Diffstat (limited to 'testapp/yaksh_app/static')
-rw-r--r-- | testapp/yaksh_app/static/yaksh_app/js/question_filter.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/testapp/yaksh_app/static/yaksh_app/js/question_filter.js b/testapp/yaksh_app/static/yaksh_app/js/question_filter.js new file mode 100644 index 0000000..065b06b --- /dev/null +++ b/testapp/yaksh_app/static/yaksh_app/js/question_filter.js @@ -0,0 +1,47 @@ +$(document).ready(function(){ + $question_type = $("#id_question_type"); + $marks = $("#id_marks"); + $language = $("#id_language"); + + function question_filter() { + $.ajax({ + url: "/exam/ajax/questions/filter/", + type: "POST", + data: { + question_type: $question_type.val(), + marks: $marks.val(), + language: $language.val() + }, + dataType: "html", + success: function(output) { + var questions = $(output).filter("#questions").html(); + $("#filtered-questions").html(questions); + } + }); + } + + $question_type.change(function() { + question_filter() + }); + + $language.change(function() { + question_filter() + }); + + $marks.change(function() { + question_filter() + }); + + $("#checkall").live("click", function(){ + if($(this).attr("checked")) { + $("#filtered-questions input:checkbox").each(function(index, element) { + $(this).attr('checked', true); + }); + } + else { + $("#filtered-questions input:checkbox").each(function(index, element) { + $(this).attr('checked', false); + }); + } + }); +});
\ No newline at end of file |