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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add HTML attribute to ejGrid`s toolbar

Thread ID:

Created:

Updated:

Platform:

Replies:

119982 Aug 20,2015 05:03 AM Aug 24,2015 01:09 AM JavaScript 3
loading
Tags: ejGrid
Feldman Daniel
Asked On August 20, 2015 05:03 AM

Hi Syncfusion team!

Your software helped me many times so far, but now I have a problem that I can`t solve. In JavaScript I need to add a HTML attribute to my toolbar items in ejgrid. Concretely I want to add for every item in my toolbar a click.trigger attribute with different values in order to handle this click event with Aurelia framework. 

I tried to use toolbarClick: "onToolBarClick", and I called the desired view-model function within onToolBarClick() with Aurelia`s container, but this didn`t seems to works as well as I excepted. With click.trigger attribute it would solve my problem. This is my toolbar in ejGrid :

toolbarSettings: {
            showToolbar: true,
            toolbarItems: [
               ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit,
               ej.Grid.ToolBarItems.Delete
            ],

        },

My question is how can I add a HTML attribute for my toolbar items?

Thanks in advice: Daniel Feldman 


Balaji Marimuthu [Syncfusion]
Replied On August 21, 2015 05:08 AM

Hi Feldman,

Thanks for using Syncfusion Products.

We can add HTML attributes to Toolbar items by using the jQuery attribute (attr) property in Grid create event. Please refer the sample and code example as below,
Sample:  http://jsplayground.syncfusion.com/0zu3ljx5


  $(function () {

            $("#Grid").ejGrid({

                // the datasource "window.gridData" is referred from jsondata.min.js

                dataSource: window.gridData,

                allowPaging: true,

                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },

                toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },


                create: "create",

            });

           



        });


        function create(args) {

            $("#" + this._id + "_add").attr({ style: "height: 30px; width: 100px;" });
        }


In the create event, we have added style properties to the toolbar Add item. Also refer the help document for create event.
http://helpjs.syncfusion.com/js/api/ejgrid#events:create


Please get back to us if you need any further assistance.

Regards,
Balaji Marimuthu

Feldman Daniel
Replied On August 21, 2015 06:09 AM

Thank you!

The code works well. As I saw in the page inspector, the click.trigger attribute was added succecfully to my desired items. Unfortunately this didn`t fired the function but this problem is related to Aurelia framework. I will write to them about this.

Thank you for quick helping!


Balaji Marimuthu [Syncfusion]
Replied On August 24, 2015 01:09 AM

Hi Feldman,

Thanks for the response.

We are happy to hear that the issue is resolved at your end.

Please get back to us if you need any further assistance. We will be happy to assist you.

Regards,
Balaji Marimuthu

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.

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

;