Bootstrap-table: Set row style after is loaded?

Created on 28 Apr 2016  路  6Comments  路  Source: wenzhixin/bootstrap-table

We have a table with a set of data and have a button click to validate the data for one reason or another. I would like change to row style of a row that isn't valid. Say I have 4 rows and after all of the data is validate we find that the data in the 3 row is invalid, can we change the row to be red to show this is an invalid row?

Is there a way to do that now? It doesn't seem so but I wanted to ask before I start looking at creating an extension to do this.

Thanks in advance

feature

Most helpful comment

Good morning @djhvscf

http://issues.wenzhixin.net.cn/bootstrap-table/#options/table-style.html
I think the rowStyle option is what @rpannell want.

function rowStyle(row, index) {
    If (!row.valid) {
         return {css: {color: 'red'}};
    }
    return {};
}

All 6 comments

See this example http://issues.wenzhixin.net.cn/bootstrap-table/#issues/563.html let me know if this works for you

Good morning @djhvscf

http://issues.wenzhixin.net.cn/bootstrap-table/#options/table-style.html
I think the rowStyle option is what @rpannell want.

function rowStyle(row, index) {
    If (!row.valid) {
         return {css: {color: 'red'}};
    }
    return {};
}

row style would when the data is loaded, I need something after the data is loaded and it's not an event. I want to be able to search the table, find my row and then update the row styling. I know I can use jquery searching the date-index field on the TR element, but didn't know if there was something build into bootstrap table to do that so to cover all of the other necessary css change for that row to happen. Basically I would need the ability to run the "rowStyle" function after the data is loaded by a row index or an unique id.

I can write an extension to handle thison my end, I already have a couple of extensions that at some point would like to make public, just need permission from my company to do that.

Great! So in your case there is not any built-in function in order to do that. Let us know if we can have your extensions

Hi,
im having a similar issue,

  1. load table and use rowstyle (works fine)
    return { 'css': { 'font-weight':'bold' } }
  2. expand row with PLUS symbol to show more details (works fine)
  3. onExpandRow function - how to remove the rowstyle in here?
    only way ive found is below
    $('#messagestable tbody tr[data-uniqueid="'+index+'"] td').css({'font-weight':''});
    Regards
    Simon

Use a custom extension to solve this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DavidKrupi picture DavidKrupi  路  23Comments

marccollin picture marccollin  路  15Comments

btran1802 picture btran1802  路  30Comments

havok2063 picture havok2063  路  39Comments

jesussuarz picture jesussuarz  路  17Comments