We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

DropDown List

Hi

 I need a help to control the click functionality in drop down from the header button,we are having list of Grid records with check box option,if we do select more than one record click functionality should enable for the particular option from the Header button drop down,if we didn't select any Grid record particular option from the Header button drop down should disable.Kindly find the below attached screen shot, by click on More button on the Header it will show the list of options,below that we are having records with check box option.


Thanks in Advance.


Regards,

Sunithra.C

Attachment: samplescreensht_4a369e7f.zip

1 Reply

TS Thavasianand Sankaranarayanan Syncfusion Team July 1, 2019 01:14 PM UTC

Hi Sunithra, 

Greetings from Syncfusion support. 

We can achieve your requirement using the rowSelected, rowDeselected event of Grid. 

Refer the below code example. 

[app.component.html] 

<ejs-dropdownlist id='games' #dropdown width='150px' [dataSource]='sportsData' [value]='value' [fields]='fields' [placeholder]='waterMark' [popupHeight]='height'></ejs-dropdownlist> 
 
<ejs-grid [dataSource]='data' #grid allowPaging='true' (rowSelected)='rowSelected($event)' (rowDeselected)='rowDeselected($event)' [enableHover]="false" [allowSelection]="true" [selectionSettings]="selectOptions"> 
  <e-columns> 
    <e-column type='checkbox' width='50'></e-column> 
    <e-column field='OrderID' isPrimaryKey='true' headerText='Order ID' width='120' textAlign='Right'></e-column> 
    <e-column field='CustomerName' headerText='Customer Name' width='150'></e-column> 
    <e-column field='OrderDate' headerText='Order Date' width='130' format="yMd" textAlign='Right'></e-column> 
    <e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'></e-column> 
    <e-column field='ShippedDate' headerText='Shipped Date' width='130' format="yMd" textAlign='Right'></e-column> 
  </e-columns> 
</ejs-grid> 
---------------------------------------------------------------------------------------- 
[app.component.ts] 

export class AppComponent { 
  @ViewChild('dropdown') 
  public dropdownObj: DropDownListComponent; 
  @ViewChild('grid') 
  public gridObj: GridComponent; 
   
    ---- 
 
  public ngOnInit(): void { 
    this.data = orderDetails; 
    this.selectOptions = { persistSelection: true }; 
  } 
  rowSelected(args) { 
    if (this.gridObj.getSelectedRowIndexes().length >= 2) { 
      this.dropdownObj.enabled = true; 
    } 
    else { 
      this.dropdownObj.enabled = false; 
    } 
  } 
  rowDeselected(args) { 
    if (this.gridObj.getSelectedRowIndexes().length < 2) { 
      this.dropdownObj.enabled = false; 
    } 
  } 
} 


We have prepared a simple sample in the following stackblitz link. 


Refer the help documentation. 




Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon