This is a migrated thread and some comments may be shown as answers.

Changing page size options when having Position="TopAndBottom"

1 Answer 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sophie
Top achievements
Rank 1
Sophie asked on 10 Dec 2012, 11:14 AM
Hi,

I have a RadGrid with PagerStyle Position="TopAndBottom". I need to change the page size options displayed in the rendered drop down lists, but I am unable to change the options in the seconds (Bottom) drop down list.

Here's my code (but it only affects the first drop down list):

function setUpPager(radGrid) {
    var comboBox = $telerik.findControl(radGrid.get_element(), "PageSizeComboBox");

    var comboItem100 = new Telerik.Web.UI.RadComboBoxItem();
    comboItem100.set_text("10000");
    comboItem100.set_value(100);
    comboItem100.get_attributes().setAttribute("ownerTableViewId", radGrid.get_masterTableView().get_id());

    comboBox.trackChanges();
    comboBox.get_items().add(comboItem100);
    comboBox.commitChanges();
}

Anyone knows how to make the code affect also the second drop down? I am using version 2011.2.

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 13 Dec 2012, 07:14 AM
Hi Sophie,

In order to achieve your scenario you could loop through both rgPager elements and execute the setUpPager function as shown in the example below.
function setUpPagers(radGrid)
{
    var pagers = $telerik.getElementsByClassName(radGrid.get_element(), "rgPager", "tr");
    for (var i = 0; i < pagers.length; i++)
    {
        setUpPager(pagers[i]);
    }
}
 
function setUpPager(pagerElement)
{
    var comboBox = $telerik.findControl(pagerElement, "PageSizeComboBox");
 
    var comboItem100 = new Telerik.Web.UI.RadComboBoxItem();
    comboItem100.set_text("10000");
    comboItem100.set_value(100);
    comboItem100.get_attributes().setAttribute("ownerTableViewId", radGrid.get_masterTableView().get_id());
 
    comboBox.trackChanges();
    comboBox.get_items().add(comboItem100);
    comboBox.commitChanges();
}


Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Sophie
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or