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

Configure all grids of my project just once

Hello,

I didn't find nothing on forum and documents about how to configure all grids of my project just once (something like inherits).

For example, I wouldn't like to set allowSorting = "true" for each grid in my project using CTRL+C and CTRL+V. But I'd like all grids on my software allow sorting, grouping, reordering, etc..

I tried using pure javascript but some configurations as either allowGrouping or toolbar (just 2 examples) I just can set it using the razor helper. If I do this using javascript, the grid freezes.

I'm not using Angular, Vue or React. Just ASP.NET Core 2.0, jquery and javascript.

I'm attaching a file to help the understanding.

Thank you.

Attachment: CommonCode_f40fc0d1.zip

18 Replies

MF Mohammed Farook J Syncfusion Team December 7, 2018 09:17 AM UTC

Hi Maikel, 
 
Thanks for contacting Syncfusion support. 
 
Query :  For example, I wouldn't like to set allowSorting = "true" for each grid in my project using CTRL+C and CTRL+V. But I'd like all grids on my software allow sorting, grouping, reordering, etc.. 
 
We have analyzed your query and we can achieve your requirement by passing properties object to the setProperties method of the grid. Please refer to the below sample for your reference, 
 
Code Example: 
 
... 
 
<div> 
    <ejs-grid id="Grid" dataSource="ViewBag.Master" created="created"> 
       <e-grid-columns> 
            ... 
       </e-grid-columns> 
    </ejs-grid> 
</div> 
<br> 
<div> 
    <ejs-grid id="Grid1" dataSource="ViewBag.Master" created="created"> 
       <e-grid-columns> 
            ... 
       </e-grid-columns> 
    </ejs-grid> 
</div> 
<br /> 
<div> 
    <ejs-grid id="Grid2" dataSource="ViewBag.DataSource" created="created"> 
        <e-grid-columns> 
... 
       </e-grid-columns> 
    </ejs-grid> 
</div> 
<script> 
   var prop = {                                               //common properties for multiple grids 
        allowSorting: true, 
        allowFiltering: true, 
        toolbar: ["Print", "ExcelExport"], 
        allowGrouping: true, 
        showColumnMenu: true, 
        allowExcellExport: true, 
        allowFiltering: true, 
        allowPaging: true, 
        allowResizing: true, 
        allowPdfExport: true ...  //more properties as per your requirements 
 
    }; 
 
    function created() { 
        this.setProperties(prop); 
    } 
</script> 
... 
 
 
Please get back to us for further assistance. 
 
 
Regards, 
J Mohammed Farook 



MC Maikel Cordeiro December 7, 2018 02:14 PM UTC

Hello,
Exactly what I needed. Pretty awesome!
But I think there is a bug on param enablePersistence="true" (I'm using version 16.3.0.29)
When I used this way you suggested (with javascript) persistence doesn't work fine. Columns are reordered as I left but group by (actually I opened a thread with some issues with bootstrap tab component conflict with Group By) is not working. The grid loads without grouping but reordered.
Can you help me with this Group By issue?

Another question, how can I set groups of settings (like filtering) using javascript, using the same thought you gave me? For example the razor helpers:

  <e-grid-filterSettings type='FilterBar'
                         mode='Immediate'
                         ignoreAccent='true'
                         immediateModeDelay='1'>
  </e-grid-filterSettings>

  <e-grid-pagesettings pageSizes="true">
  </e-grid-pagesettings>

I'd like to pass it using javascript, not razor.

Thank you so much.
Best Regards
MC


MF Mohammed Farook J Syncfusion Team December 10, 2018 10:06 AM UTC

Hi Maikel, 
 
Thanks for contacting Syncfusion support. 
 
Query :  When I used this way you suggested (with javascript) persistence doesn't work fine. Columns are reordered as I left 
 
We have analyzed your query and enablePersistance property cannot be dynamically assigned to the grid. So to implement the enablePersistance property, we suggest to provide it along with the grid code initialize. And about the reorder functionality, it may have persisted from the local storage please clear it and run the grid. 
 
Query  #2:  how can I set groups of settings (like filtering) using javascript, using the same thought you gave me? 
 
<e-grid-filterSettings type='FilterBar' 
                         mode='Immediate' 
                         ignoreAccent='true' 
                         immediateModeDelay='1'> 
  </e-grid-filterSettings> 
 
  <e-grid-pagesettings pageSizes="true"> 
  </e-grid-pagesettings> 
 
Please refer to the below code snippets for providing settings property through javascript, 
 
Code Example: 
 
... 
filterSettings: { type: 'FilterBar', mode: 'Immediate', ignoreAccent: 'true', immediateModeDelay: '1' }, 
pageSettings: { pageSizes: true } 
... 
 
 
Please get back  to us  for further assistance. 
 
Regards, 
J Mohammed Farook 
 



MC Maikel Cordeiro December 10, 2018 12:38 PM UTC

Hi,

I think there is a misunderstanding, I'm sorry about that. Reorder features is working fine. Group By functionality is not working fine when I use setProperties method.

All time I set enablePersistence="true" on the grid creation code as the same way you said. Actually I tried all the ways. But if I use the setProperties method, the grid is created without the group that I leave.

I'm attaching a video to show that.

Thank you.

Attachment: GroupByJavascriptProblems_623afd10.7z


MC Maikel Cordeiro December 10, 2018 07:33 PM UTC

Hello,

I realized what is the problem. When I set locale = 'pt-BR' (I think it happens to any locale) the problem I mention occurs.

In this case I have to configure the grid not passing this using javascript and load persistense with group by works fine.

So I realized that we have another problem: When I use Group By feature (it's not related to persistense) and Filter (FilterBar in this case) with mode setting set to 'immediate' when I type something to filter the field looses focus. It only occurs when the grid is grouped by. 

Follow the steps to reproduce the problem:

1. Set Filter as FilterBar and the mode of filter as Immediate
2. Run the software
3. Group the grid with any column
4. Click on the filter and type any char
5. Wait the filter event occurs and... the textbox of filter looses focus.

If you repear all steps without grouping column, it works fine.

Thanks again.


MF Mohammed Farook J Syncfusion Team December 13, 2018 06:32 AM UTC

Hi Maikel, 

Thanks for contacting Syncfusion support. 

Query #1: I realized what is the problem. When I set locale = 'pt-BR' (I think it happens to any locale) the problem I mention occurs. 
 
We have analyzed your query and we have already fixed this issue in the recently released beta version. So we suggest to update your grid to the latest beta version to fix this issue. 
Please refer to the below sample for your reference. 


Query #2: when I type something to filter the field looses focus. It only occurs when the grid is grouped by. 

We are able to reproduce the reported issue at our end. We have logged filter a field looses focus on filterbar when the grid is grouped by any column’ as a bug and the fix for this issue will be available in any of our upcoming releases. 

We appreciate your patience until then. 
 
 
Regards, 
J Mohammed Farook 



MC Maikel Cordeiro December 13, 2018 11:30 AM UTC

Ok, thank you very much.

How can I know when it will be fixed? You will follow up this process?

Best Regards.


MF Mohammed Farook J Syncfusion Team December 13, 2018 11:46 AM UTC

Hi Maikel,  
 
Thanks for your update. 
 
We will include the fix  for “filter a field looses focus on filterbar when the grid is grouped by any column” this issue  in our upcoming patch release on first week of January 2019. 
 
Regards, 
J Mohammed Farook. 



MC Maikel Cordeiro January 8, 2019 09:37 PM UTC

Hi, 

I was reading release notes of 16.4.42 version and I didn't find anything about this issue.

Does we have a date to deliver version with this fix?

Thanks 

MC


PS Pavithra Subramaniyam Syncfusion Team January 9, 2019 12:15 PM UTC

Hi Maikel, 
 
Since the issue “filter a field looses focus on filterbar when the grid is grouped by any column” fix was included in 16.4.44 version, Please check the following release note for more information. 
 
 
Regards, 
Pavithra S. 



MC Maikel Cordeiro January 9, 2019 12:22 PM UTC

Hello,

Pretty awesome! I noticed on nuget it's available version 46 as stable, but I can't generate license key for this version, only for 42 (BTW, I'm using this version).

When will it be possible to generate that for 46?

Thanks again.

MC.


PS Pavithra Subramaniyam Syncfusion Team January 10, 2019 08:55 AM UTC

Hi Maikel, 
 
The v16.4.0.46 is weekly NuGet release version. Our Syncfusion license key works with version specific. During the license validation, the build number (Last digit, either 42 or 46) will not be considered. So, any 16.4.0.* license key will work for v16.4.0.42,v16.4.0.44, and v16.4.0.46.  Also, we are currently, working to list the NuGet weekly release version in the dropdown.   
Regards, 
Pavithra S. 
 



MC Maikel Cordeiro January 10, 2019 11:37 AM UTC

Hi,

Perfect. I'd like to thank you about this explanation. Actually I thought it works like that but it's good know from you if this is really true.

I'll test it and feedback you guys later.

Best Regards

MC


PS Pavithra Subramaniyam Syncfusion Team January 10, 2019 11:47 AM UTC

Hi Maikel, 
 
Thanks for your update. 
 
Please contact us if you need any further assistance. 
 
Regards, 
Pavithra S. 
 



MC Maikel Cordeiro January 10, 2019 12:13 PM UTC

Hello, 

Unfortunately now I have a worse problem, it never focus :-(

There is an attached file on this message.

Thanks

MC

Attachment: FocusProblem_2dc2559.7z


PS Pavithra Subramaniyam Syncfusion Team January 11, 2019 05:43 AM UTC

Hi Maikel , 
 
We have prepared the sample with your query. But unfortunately reported issue is not reproduced in our end. So, we have shared our sample for your reference and that can be download from the below link. 
 
 
For your reference we have also shared the Video demonstration: http://www.syncfusion.com/downloads/support/directtrac/141353/7z/69vQWbYR6v-1670132393.7z   
 
Please share the following detail that will helpful for us to provide a better solution as early as possible. 
 
  1. Ensure the focusIn/focusOut event is bind your sample at externally.
  2. Share Syncfusion Essential studio 2 version details.
  3. Check the Console window as return any script error while focus out from the filterBar.
  4. Ensure the external Click event bind in your application.
  5. Share the Grid code with controller code.
 
Please get back to us, if you need any further assistance. 
 
Regards, 
Pavithra S. 



MC Maikel Cordeiro January 16, 2019 07:02 PM UTC

Hello,

I'm sorry. I am able to handle this subject only now.

So, Id like to apologize. Watching the video I found my mistake. I updated nuget package but I didn't change the CDN address to the version 46.

Now I did it, as the same way you showed in the video and it worked perfectly. 

Thank you very much!

Best Regards

MC


VA Venkatesh Ayothi Raman Syncfusion Team January 17, 2019 05:06 AM UTC

Hi Maikel, 

Thanks for the update. 

We are very happy to hear that your requirement is achieved. 

Regards,
Venkatesh Ayothiraman. 


Loader.
Up arrow icon