3

Developing SPFX app, where everything looks good(I mean the width) in edit mode, soon after publish the webpart width is getting reduced somehow.

Using Fabric UI CSS


.propertyDigitalManagementWebpart {
  .container {
    margin: 0px auto;
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
  }

  .grid {
    @include ms-Grid;
  }

  .row {
    @include ms-Grid-row;
    //@include ms-fontColor-white;
    //background-color: $ms-color-themeDark;
    padding: 20px;
  }

  .column10 {
    @include ms-Grid-col;
    @include ms-lg10;
    @include ms-xl8;
  }

  .column2 {
    @include ms-Grid-col;
    @include ms-lg2;
  }

  .column1 {
    @include ms-Grid-col;
    @include ms-lg1;
  }

Main webpart has below code

<div className={styles.propertyDigitalManagementWebpart}>
        <div className={styles.grid}>
          <ContainerComponent />
        </div>
      </div>

Sub Component - Container

 <div className={styles.row}>
        <div className={selectedPrptyRecord ? styles.column9 : styles.column12} >
          <TextField id="standard-basic" label="Search" onChange={srcTextFieldChange} />
        </div>
      </div>
      <div className={styles.row}>
        <div className={selectedPrptyRecord ? styles.column9 : styles.column12} >
          <div style={{ minHeight: "768px" }} >
            <DataGrid rows={propertyRecords} columns={columns} pageSize={10}
              onSelectionChange={(newSelection) => {
                console.log("selection event");
                console.dir(newSelection);
                SelectedRowEvent(newSelection.rowIds);
              }}
              hideFooterSelectedRowCount={true}
              rowsPerPageOptions={[5, 10, 20]}
            />
          </div>
        </div>
        {selectedPrptyRecord != null && Object.keys(selectedPrptyRecord).length > 0 &&
          <SidePanelComponent selectedRecord={selectedPrptyRecord} closeEvent={handleClose} />
        }
      </div>

enter image description here

I don't know what's causing the issue to shrink the webpart after publish

1

the workaround or css tweak is

:global(#workbenchPageContent) {  
  max-width: initial;  
} 

:global(.CanvasZone > div) {  
  width: 100%;  
} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.