enter image description here我想通过文本框和“添加”按钮在表的行中显示值。有标题名称“派对ID”,当我单击“删除符号”时。应该将其删除,但剩余值应在表中显示。
在数据库中的值将以逗号分隔的值存储。
//party Id
td11 = $('<TD/>')
.append($('<input/>').attr({'id': 'customerPartyId', 'type': 'text', 'class': 'customerDealId', 'maxlength': '10'}).val(customer.partyId).prop("readonly", true))
.append(
$('<input/>').attr({'id': 'savePartyId', 'type': 'button', 'value': 'Edit', 'class': 'button primary slim product-message-btns'})
.click(function(){
$(this).parent().find("#partyIdMsg").html();
$(this).blur();
if($(this).val()=='Edit'){
$(this).parent().find('#customerPartyId').removeClass('customerDealId').prop("readonly", false);
$(this).val('Add');
if($(this).data('oldPartyId')==undefined)
$(this).data('oldPartyId',$(this).parent().find('#customerPartyId').val());//remember old value in case of failure
}else if($(this).val()=='Add'){
var mdcpId = $(this).parent().parent().find('#mdcpId').html();
var crsId = $(this).parent().parent().find('#crsId').html();
var newPartyId= $(this).parent().find('#customerPartyId').val().trim();
if(newPartyId== $(this).data('oldPartyId')){
if(newPartyId=='')
$(this).parent().find("#partyIdMsg").html('Please enter a number to Update as Party ID.');
else
$(this).parent().find("#partyIdMsg").html('party ID is the same as the existing one.');
$(this).removeClass("partySaved");
$(this).val('Edit');
$(this).parent().find('#customerPartyId').addClass('customerDealId').prop("readonly", true);
if($('#bundle_customer_grid').find('.partySaved').length>0 || $('#bundle_partner_grid').find('.partySaved').length>0){
$('#updatePartyIdsButton').removeClass("cancel").addClass("primary").prop('disabled', false);
$('#bundle_customer_grid').find('img').parent().data('deleteImgMsg','occ.delCustomerDisabled');
}else{
$('#updatePartyIdsButton').removeClass("primary").addClass("cancel").prop('disabled', true);
//if (customerWidget.isOCAGlobalDuns == false || customerWidget.isOCAGlobalDuns == '' || customerWidget.isOCAGlobalDuns == null) {
$('#searchBundleCustomerButton').removeClass("cancel").addClass("primary").prop('disabled', false);
//}
$('#bundle_customer_grid').find('img').parent().data('deleteImgMsg','occ.delCustomerMsg');
}
}
//check if newPartyId is a number (could be empty)
else if(newPartyId!=null && newPartyId!='' && /^\d+$/.test(newPartyId)==false){
$(this).parent().find("#partyIdMsg").html('Part ID should be a number.');
$(this).removeClass("partySaved");
if($('#bundle_customer_grid').find('.partySaved').length>0 || $('#bundle_partner_grid').find('.partySaved').length>0){
$('#updateDealIdsButton').removeClass("cancel").addClass("primary").prop('disabled', false);
$('#bundle_customer_grid').find('img').parent().data('deleteImgMsg','occ.delCustomerDisabled');
}else{
$('#updateDealIdsButton').removeClass("primary").addClass("cancel").prop('disabled', true);
$('#searchBundleCustomerButton').removeClass("cancel").addClass("primary").prop('disabled', false);
$('#bundle_customer_grid').find('img').parent().data('deleteImgMsg','occ.delCustomerMsg');
}
}else{
$(this).val('Edit');
//call ews service for party updation
var that = this;
var partyToUpdate = {mdcpId:mdcpId, crsId:/*crsId*/'', newPartyId:newPartyId};//biz req to mask crsID, so only validate against orgID by setting empty crsID
getServerData({widget_id:'bundleCustomerWidget', method:'updateCustomerPartyId', 'partyToUpdate':partyToUpdate}, function(resp){
if(resp.Success==true){
$(that).addClass("partySaved");//identify edited rows
}else{// 2 cases: internal error or invalid deal, dealt in the same way
$(that).removeClass("partySaved");
$(that).parent().find('#customerPartyId').val($(that).data('oldPartyId'));
}
//display status msg
$(that).parent().find("#partyIdMsg").html(resp.StatusMessage);
$(that).parent().find('#customerPartyId').addClass('customerDealId').prop("readonly", true);
if($('#bundle_customer_grid').find('.partySaved').length>0 || $('#bundle_partner_grid').find('.partySaved').length>0){
$('#updatePartyIdsButton').removeClass("cancel").addClass("primary").prop('disabled', false);
$('#bundle_customer_grid').find('img').parent().data('deleteImgMsg','occ.delCustomerDisabled');
}else{
$('#updatePartyIdsButton').removeClass("primary").addClass("cancel").prop('disabled', true);
$('#searchBundleCustomerButton').removeClass("cancel").addClass("primary").prop('disabled', false);
header name party id,text box and button name ADD in table all text box data should be display in tablewhen I enter value in text box data should be insert in database's table as comma seprated values in single collumn name of column party id
您可以为表格发布HTML代码吗?>