Objectorder in grid tiilbar changes

Hi - I have made a toolbar in my grid like this:

   public List<Object> ToolbaritemsString = new List<Object>(){ "Add", "Update", "Cancel", "Delete",
        new ItemModel() { Text = "Sale only", Id = "Sale", TooltipText = "Show only products with sale", PrefixIcon = "e-check" }, "Excel Export", "ColumnChooser" };

and in the grid I simply refer the ToolbaritemString <SfGrid @ref="Grid" DataSource="@Data" ShowColumnChooser="true" Toolbar="ToolbaritemsString".

When I click the "Sale only" button it changes place with the Excel Export button. How to I make sure the order of elements stay the same? 




5 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team October 22, 2020 01:20 PM UTC

Hi Soren, 

Greetings from Syncfusion support. 

We are not clear about the exact scenario of the problem you are facing. We tried reproducing by creating a sample based on this case. But we could not see any swaping of toolbar items when clicking on “Sale Only” item in toolbar. We are attaching the sample for your reference. Please download the sample form the link below, 
 
If you are still facing difficulties, then the following details would be helpful for us to proceed further. 
  1. Share with us a video demo showing the problem you are facing.
  2. Share the exact scenario or proper replication procedure.
  3. If possible, reproduce the problem with the attached sample and share with us for further analysis.
  4. Share the complete Grid rendering codes.

The provided information will help us analyze the problem, and provide you a solution as early as possible. 

Regards, 
Renjith Singh Rajendran 



SM Soren M October 26, 2020 10:03 AM UTC

Please see att. code.
/Søren 


Attachment: ServersampleToolbarIssue_aef366e8.zip


RS Renjith Singh Rajendran Syncfusion Team November 6, 2020 01:14 PM UTC

Hi Soren, 

Thanks for your update. 

Based on this scenario, we suggest you to use as like the below codes, instead of changing the entire Toolbar property value. Please refer and use the below highlighted codes in your application. We have also modified the sample for your convenience, please download the sample from the link below, 

 
public void ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args, string grid) 
{ 
    if (args.Item.Id == "Sale") 
    { 
        if (ToolbarSalesIconChecked) 
        { 
            //ToolbaritemsString = ToolbarUnchedkedSalesIcon; 
            (ToolbaritemsString[2] as ItemModel).PrefixIcon = "e-More"; 
            ... 
        } 
        else 
        { 
            //ToolbaritemsString = ToolbarCheckedSalesIcon; 
            (ToolbaritemsString[2] as ItemModel).PrefixIcon = "e-check"; 
            ... 
        } 
    } 
} 


Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Marked as answer

SM Soren M November 10, 2020 12:01 PM UTC

Thanks Renjith, this is a fine workaround.


RS Renjith Singh Rajendran Syncfusion Team November 11, 2020 07:26 AM UTC

Hi Soren, 

Thanks for your update. 

We are glad to hear that the provided suggestion helped you in achieving this requirement. 

Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran 


Loader.
Up arrow icon