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.

When I add columns the scroll bar doesnt scroll the columns.

Thread ID:

Created:

Updated:

Platform:

Replies:

121891 Feb 4,2016 04:37 AM Feb 5,2016 04:06 AM ASP.NET MVC 2
loading
Tags: Grid
Matheu
Asked On February 4, 2016 04:37 AM

Hey

As in the subject heading i add columns to the grid using the following code i cant scroll properly.

function addColumns(cols)
    {
        colWidth = 100;
        var gridObj = $("#grid").data("ejGrid");
        for (var i = 0; i < cols.length; ++i)
        {
            gridObj.columns(cols[i], "add");
            gridObj.resizeColumns(cols[i], colWidth);
            width += 100;

        }
    }

however now when i scroll only the grid with the data values scrolls. I attached images of what it looks like.

Also here is the original table.

@(Html.EJ().Grid<ChartData>("grid")
        .Datasource((IEnumerable<object>)ViewBag.gridData)
        .AllowPaging()
        .AllowGrouping()
        .AllowSorting()
        .AllowScrolling()
        .ScrollSettings(scroll => { scroll.Height(300).Width(970); })
        .Columns(col =>
        {
            col.Field("name").HeaderText("Indicator").TextAlign(TextAlign.Justify).Width(75).Add();
        })
)

How can i add the columns correctly so that they will still scroll?

Regards,
Matheu

Attachment: scroll_issue_cfccc013.zip

Matheu
Replied On February 4, 2016 03:55 PM

So I finally got it working, sort of.

instead of using the api I make the grid in a partial and ajax it in adding columns in the razor view with code like this:

        .ScrollSettings(scroll => { scroll.Width(ViewBag.width); })
        .Columns(col =>
        {
            col.Field("name").HeaderText("Geo Item").IsPrimaryKey(true).TextAlign(TextAlign.Left).Width(75).Add();
            if (ViewBag.cols != null)
            {
                foreach (var x in ViewBag.cols)
                {
                    col.Field(x).HeaderText(x).TextAlign(TextAlign.Right).Width(75).Add();
                }
            }
        })

where cols is a List<string> and width is a counter that i incremented by 150 so the table grows by 150 for each column.

Jayaprakash Kamaraj [Syncfusion]
Replied On February 5, 2016 04:06 AM

Hi Matheu, 


Thanks for the update.

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


Regards, 

Jayaprakash K.


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.

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.

;