Bootstrop-table data table row modification, bootstrop

Source: Internet
Author: User

Bootstrop-table data table row modification, bootstrop

Bootstrop-table data row Modification
Set the attribute editable :{
Type: 'text', // The data is displayed in the text box.
Emptytext: "--", // displayed when the data is empty
Validate: function (value ){
If ($. trim (value) = ''){
Return 'cannot be blank'; // modify to display empty data
}
}
}
Set attributes when loading data in bootstrop-table in js
OnEditableSave: function (field, row, oldValue, $ el ){
$ ('# Id'). bootstrapTable ('resetview ');
Row = dataWarp (row, field); // you can write or not repackage data during editing.
$. Ajax ({
Type: "post ",
Url: path,
Data: row, // data modified in the row
DataType: 'json ',
Success: function (data, status ){
If (status = "success "){
Modal. alert ({
Msg: "edited! "
});
}
},
Error: function (){
Modal. alert ({
Msg: "editing failed! "
});
$ ('# Id'). bootstrapTable ('refresh'); // refresh after the data is loaded successfully

},
Complete: function (){

}

});
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.