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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataGrid and Multiselect

Thread ID:

Created:

Updated:

Platform:

Replies:

144188 Apr 22,2019 07:46 PM UTC Apr 26,2019 06:01 AM UTC ASP.NET Core - EJ 2 5
loading
Tags: DataGrid
Nelson
Asked On April 22, 2019 07:46 PM UTC

If i had a multiselect dropdown  in a grid cell (razor page)  with a multiselect filled with objects direct from a db. How can i get the selected values in the handler of the grid(with urladaptor)? Can i get some example?
Thanks

Vignesh Natarajan [Syncfusion]
Replied On April 23, 2019 04:49 AM UTC

Hi Nelson,  

Thanks for contacting Syncfusion forums. 

Query: “How can i get the selected values in the handler of the grid(with urladaptor)? 

Before proceeding with your query, we need some additional details regarding your query. So kindly share the following details.  

  1.  Share the Grid rendering code.(client and server side).
  2. You have mentioned that you are using multiselect dropdown in Grid, are you referring to dropdown control with multiselect option or individual MultiSelect control. Kindly confirm your control which you have used inside the Grid.
  3. Share the code example how you have rendered the multiselect dropdown (i.e) using columnTemplate or edit type of column?
  4.  Confirm your Essential JavaScript version. (i.e) EJ1 or EJ2.

Requested details will be helpful for us to validate the reported issue at our end and provide the solution as soon as possible. 

We also would like to let you know about our next generation JavaScript product - Essential JS 2, in case if you are not aware of it. Essential JS 2 is fully re-written to be modular, responsive and lightweight.  
   
We suggest you consider our following product page for more details. 
  
   
Demo page for ej2 Grid  


Regards, 
Vignesh Natarajan. 


Nelson
Replied On April 23, 2019 07:45 PM UTC

Thanks. Yes, im using EJ2 and a multiselect control. Im adding some sample of the code

Attachment: Desktop_a55a3139.rar

Hariharan J V [Syncfusion]
Replied On April 25, 2019 09:18 AM UTC

Hi Nelson, 
 
Based on your requirement we have created a sample. Here, we have created multiselect dropdown by using cell edit template. Please find the below code example and sample for your reference. 
 
[code example] 
... 
<ejs-grid id="Grid" allowPaging="true" load="onLoad" toolbar="@( new List<object>() {"Add","Edit","Delete","Update","Cancel"})"> 
    <e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch"></e-grid-editsettings> 
    <e-data-manager url="/Index?handler=DataSource" batchUrl="/Index?handler=BatchUpdate" adaptor="UrlAdaptor"></e-data-manager> 
    <e-grid-pageSettings pageCount="5" pageSize="5"></e-grid-pageSettings> 
    <e-grid-columns> 
        <e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="120"></e-grid-column>         
        <e-grid-column field="CustomerID" headerText="Customer ID" textAlign="Right" width="120" edit="@(new {create = "onCreate", read = "onRead", write = "onWrite", destroy= "onDestroy"})"></e-grid-column> 
        ... 
   </e-grid-columns> 
</ejs-grid> 
 
<script> 
 
 
    var multiSelectEle; 
    var element 
    function onCreate(args) { 
        element = document.createElement('input'); 
        return element; 
    } 
    function onRead(e) { 
        return multiSelectEle.value; 
    } 
    function onDestroy() { 
        multiSelectEle.destroy(); 
    } 
    function onWrite(args) { 
        multiSelectEle = new ej.dropdowns.MultiSelect({    //rendering multiSelectEle component  
            dataSource: new ej.data.DataManager({ 
                url: '/Index?handler=MultiDropDataSource', 
                adaptor: new ej.data.UrlAdaptor(), 
                crossDomain: true, 
                headers: [{ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val() }] 
            }), 
            query: new ej.data.Query().select(['FirstName', 'EmployeeID']).take(10).requiresCount(), fields: { text: "FirstName", value: 'FirstName' }, 
            // set the placeholder to multiSelectEle input element 
            placeholder: 'e.g. Andrew Fuller', 
            // sort the resulted items 
            sortOrder: 'Ascending', 
            // set the filterType to searching operation 
            filterType: 'StartsWith', 
            value: args.rowData[args.column.field] 
        }); 
        multiSelectEle.appendTo(element); 
    } 
 
    ... 
    
</script> 
 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Hariharan 


Nelson
Replied On April 25, 2019 07:54 PM UTC

Hi, thanks! this work correctly.

Hariharan J V [Syncfusion]
Replied On April 26, 2019 06:01 AM UTC

Hi Nelson, 
 
Thanks for your update.  
  
We are happy to hear that the provided solution helped you.   
  
Please contact us if you need any further assistance. As always, we will be happy to assist you.   
  
Regards, 
Hariharan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon