Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BootstrapTable is not reloading data when row checkbox checked or unchecked in ReactJS #2137

Open
Periseta opened this issue Nov 3, 2021 · 0 comments

Comments

@Periseta
Copy link

Periseta commented Nov 3, 2021

Using BootstrapTable in reactjs app that populates data from .net core api.
My question is How to re-render data when row checkbox checked or unchecked.
I am displaying checkbox for one of the boolean column and disable/enable based on the row checkbox selection. Following is the code from columns definition

formatter: (cellContent:boolean, row:IFacilityReportType) => (


<input type="checkbox"
id={"primaryCheckbox"+row.facilityReportTypeId}
style={{opacity:1}}
defaultValue={row.facilityId}
onChange={(event)=>selectPrmaryContact(event, row)}
disabled={row.isRowSelected?false:true}
checked={row.isPrimary?true:false}
/>

)

In the above code, the isRowSelected is one of the data column that has false initially and all the checkboxes are disabled. When row checkbox checked/unchecked this column will get switch to true/false and column checkbox should be enable or disable. This is not happening. Its look like data is not rendering/reloading when column data changed in row selection.

Following is the row selection event code.

const selectRowFacilities:any = {
mode: 'checkbox',
selected:refeshFacilityTable==='yes'? []:null,
onSelect: (row:IFacilityReportType, isSelect:any, rowIndex:any, e:any) => {

        if(isSelect){
            row.isRowSelected=true;
        }
        else{
              row.isRowSelected=false;
        }
        
      },
      onSelectAll: (isSelect:any, rows:IFacilityReportType[], e:any) => {
       if(isSelect){
            rows.forEach(row=>{
                row.isRowSelected=true;
            });
       }
       else{
        rows.forEach(row=>{
                row.isRowSelected=false;
            });
       }
      }
  };
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant