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

how to use check/uncheck All option using Batch Editing Mode in ejgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

120643 Sep 30,2015 05:04 AM UTC Oct 1,2015 09:32 AM UTC ASP.NET MVC 1
loading
Tags: Grid
Ganga
Asked On September 30, 2015 05:04 AM UTC

Sample code:
While using batch  editing mode in ejgrid check and uncheck all option is not working.. how to set check and uncheck all option in ejgrid

VIEW:

  @(Html.EJ().Grid<ERP_WEB_MVC4_VGN.Models.GridDepModel>("DepGeneralIns")
       .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch).AllowEditOnDblClick(false); })
        .AllowPaging()      
         .AllowScrolling()
         .AllowFiltering()
         .FilterSettings(d => d.FilterType(FilterType.Excel))
        .ScrollSettings(scroll => { scroll.Height(250).Width(450); })
        .Columns(col =>
        {
        //  col.HeaderText("View1").Template("<input type='checkbox' class='check' />").HeaderTemplateID("#headerTemplate").EditType(EditingType.Boolean).TextAlign(TextAlign.Center).Width(100).Add();
            col.Field("DepSINO").HeaderText("SINO").Width(1).IsPrimaryKey(true).AllowEditing(false).Add();
            col.Field("DeptGIns").HeaderText("DEPARTMENT").Width(150).AllowEditing(false).Add();
           col.Field("DepView1").HeaderText("VIEW").Width(60).EditType(EditingType.Boolean).Add();

        })
        )


Script:

    $("#DepSaveBtn").on("click", function () {

            alert($("#generalins").val())
            var ProjObj1 = $("#DepGeneralIns").ejGrid("instance")
            ProjObj1.batchSave()
            var GridCar1 = $("#DepGeneralIns").ejGrid("model");
            var data1 = JSON.stringify(GridCar1.dataSource);
                   
            //if ($("#generalins").val() != "") {
        
                $.ajax({

                    type: "POST",
                    url: "@(Url.Action("Save", "GeneralInstruction"))",
                    data: { data: data1, GeneralInstrMsg: $("#generalins").val(), setflag: $('#SetFlagVal').val(), Chkbx: $('#ChkAndUnCheck').prop('checked') },
                    success: function (alertmsg) {

                    }

                });
            //}

        })



Prasanna Kumar Viswanathan [Syncfusion]
Replied On October 1, 2015 09:32 AM UTC

Hi Ganga,

Thanks for contacting Syncfusion support.

We have analyzed your code and found that you have used header template in your sample. We suggest you to render the header template as in the below code example.

The header Template is used to add a template in the header element of the particular column.

@(Html.EJ().Grid<object>("FlatGrid")

         .Datasource((IEnumerable<object>)ViewBag.datasource)

        .AllowSorting()

        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing().EditMode(EditMode.Batch).AllowEditOnDblClick(false);})

            .ToolbarSettings(toolbar =>

            {

                toolbar.ShowToolbar().ToolbarItems(items =>

                {

                    items.AddTool(ToolBarItems.Add);

                    items.AddTool(ToolBarItems.Edit);

                    items.AddTool(ToolBarItems.Delete);

                    items.AddTool(ToolBarItems.Update);

                    items.AddTool(ToolBarItems.Cancel);

                });

            })

        .AllowPaging()

        .Columns(col =>

        {

            col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();

            col.Field("CustomerID").HeaderText("Customer ID").Width(90).Add();

            col.Field("ShipCity").HeaderText("Ship City").TextAlign(TextAlign.Right).Width(90).Add();

            col.Field("OrderDate").HeaderText("Order Date").HeaderTemplateID("#datetemplate").TextAlign(TextAlign.Right).Width(100).Format("{0:MM/dd/yyyy}").Add();

            col.Field("ShipCountry").HeaderText("Ship Country").Width(110).Add();

            col.Field("EmployeeID").HeaderText("Emp ID").HeaderTemplateID("#employeetemplate").TextAlign(TextAlign.Right).Width(90).Add();

        })

        .ClientSideEvents(eve => { eve.ActionFailure("Failure"); })  

)


<script id="employeetemplate" type="text/x-jsrender">

    <input type="checkbox" class="check" />
</script>


Please confirm the following details

1.       Do you need to perform any operation in header template column when the checkbox is checked/ unchecked?


2.       You have mentioned that need to check and uncheck all options in the Grid. Please provide more details about the options in the Grid.

Regards,
Prasanna Kumar N.S.V              


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

;