add filter button

This commit is contained in:
luqiong 2014-09-02 16:09:10 +08:00
parent e11965f251
commit 01a0e56f6e
2 changed files with 37 additions and 33 deletions

View File

@ -1,5 +1,6 @@
var script = new Array();
var filter = new Array();
var filterArray = new Array();
$(document).ready(function() {
$.post("loadScripts", {}, function(data) {
if (!data.success) {
@ -33,42 +34,42 @@ function createFilter(){
return;
}else{
$('#selectFilter').show();
data = data.filterTypeList;
for ( var i = 0; i < data.length; i++)
filter.push(data[i]);
for( var j = 0; j < filter.length; j++){
var textNode = document.createTextNode(filter[j]);
var checkboxNode = document.createElement("input");
checkboxNode.setAttribute("type", "checkbox");
checkboxNode.setAttribute("name", "filterList");
checkboxNode.setAttribute("id", "filterList"+j);
checkboxNode.appendChild(textNode);
/* var line = $("<div style='cursor:pointer;'>");
line.click(function(){
document.getElementById(id).checked = true;
})
var input = $("<input type='radio' name="+name+" id="+id+">");
input.attr("value",value);
input.attr("text",text);
var span = $("<label for="+id+" style='cursor:pointer;'>");
span.html(text);
line.append(input);
line.append(span);
line.addClass("line");
*/
$('#filterList').append(checkboxNode);
if(!document.getElementsByClassName('clicked')[0]){
var table = $("<table></table>");
data = data.filterTypeList;
for ( var i = 0; i < data.length; i++)
filter.push(data[i]);
for( var j = 0; j < filter.length; j++){
var checkbox = createCheckbox(filter[j],filter[j]);
if(j%2==0){
var tr = $("<tr></tr>");
table.append(tr);
}
tr.append(checkbox);
}
$('#filterList').append(table);
}
}
});
}
function createCheckbox(id,text){
var line = $("<td></td>");
line.click(function(){
document.getElementById(id).checked = true;
})
var input = $("<input type='checkbox' name='filterList' id="+id+">");
input.attr("text",text);
line.append(input);
line.append(document.createTextNode(text));
line.addClass("line");
return line;
}
$("#selectFilter #ok").click(function() {
$("#selectFilter").hide();
});
$("#selectFilter #cancel").click(function() {
$("#selectFilter").hide();
$("#selectFilter #ok").addClass("clicked");
filter=[];
});
function toggleTestExecutionPlan() {
@ -525,7 +526,9 @@ function start() {
scriptList.push(new ScriptModel(scriptIdList[k], loadList[k], warmUp,
coolDown, executeRange));
}
var filterSelected = $("#filterList div input[name='filterList']:checked");
for(var i=0;i<filterSelected.length;i++)
filterArray.push(filterSelected[i].id);
var name = $("#testConfigurationName").val();
var testPlan = new TestPlanRequestModel(scriptList, ipList, name);

View File

@ -24,6 +24,10 @@ body {
.sidebar-nav {
padding: 9px 0;
}
.modal{
position:relative;
}
</style>
<link href="lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link href='css/bench4q.css' rel='stylesheet'>
@ -199,9 +203,6 @@ body {
<button type="button" class="btn btn-primary btn-width" id="ok">
<fmt:message key="plugin_jsp_finish" />
</button>
<button type="button" class="btn btn-primary btn-width" id="cancel">
<fmt:message key="plugin_jsp_cancel" />
</button>
</div>
</div>
<div id="userConfigMessage" class="hide">all input can not