index.html中:
<div class="title">
<h2 class="">SR Ref #<a href="javascript:" class="detailsSrRef"></a></h2>
<select class="event detailsEvents" data-role="none" id="selEvent">
</select>
</div>
在的script.js存在處於就緒功能初始化:
$(document).ready(function() {
.....
var serviceRequestDetailsController = new .ServiceRequestDetailsController();
serviceRequestDetailsController.setEventControllers([
new AcceptEventController(),
new RejectEventController(),
new TravelToMaterialEventController(),
new TravelToCustomerEventController(),
new ArrivedAtCustomerEventController(),
new ValidateOOSEventController(),
new CompleteActionPlanEventController(),
new ReturnPartsEventController(),
new AddTextEventController(),
new ExceptionEventController(),
new FixAcceptedEventController()
]);
.....
}
在action.js:
var html = '<option data-placeholder="true" >Select Event</option>';
for (var idx = 0; idx < eventControllers.length; idx++) {
//Fix
if (!(eventControllers[idx].getEventName() == com.ibm.client.dto.ServiceRequest.TRAVEL_TO_MATERIALS_STATUS))
if (!(eventControllers[idx].getEventName() == com.ibm.client.dto.ServiceRequest.PARTS_RETURNED_STATUS))
if (!(eventControllers[idx].getEventName() == com.ibm.client.dto.ServiceRequest.FIX_ACCEPTED_STATUS))
html += '<option value="' + utility.htmlEncode(eventControllers[idx].getEventName()) + '">' +
utility.htmlEncode(eventControllers[idx].getEventName()) + '</option>'
}
$('.detailsEvents').each(function(){
$(this).html(html);
$(this).change(function() {
var value = $(this).find(":selected").val();
$(this).sbCustomSelect();
});
這些都是我的變化在action.js的功能添加一個新的選項:
if (logicalStatus=="TAK"){
$('#selEvent').empty();
var newOption=$('<option value="' + utility.htmlEncod (com.ibm.client.dto.ServiceRequest.ADD_TEXT_STATUS) + '">' +
utility.htmlEncode (com.ibm.client.dto.ServiceRequest.ADD_TEXT_STATUS) + '</option>');
$('#selEvent').append(newOption);
}
我希望這是明確的,因爲代碼不在一個文件中。
請張貼一些代碼 – jeugen