PDA

View Full Version : [CLOSED] Page index Pagingtoolbar



multimediait
Nov 24, 2014, 3:30 PM
Good Evening, I've created a Window, within I added a paging GridPanel, is there a way to get a page index (pagingtoolbar) in OnLoad event of Window?
I need get this value to create columns, model is dynamic (database source).
To bind datasource I use ReadData event, but if I open recordset in this event and call Reconfigure method, I see empty cells.
I use this code:



private Hidden m_hdnIndex = null;

private int PageIndex
{
get
{
return new Any(Ext.Net.X.GetCmp<Hidden>("hdnIndex" + ID).Value).To(1);
}
}

protected override void OnInit(EventArgs e)
{
base.OnInit(e);

/* Code add grid */

Items.Add(m_hdnIndex = new Hidden
{
ID = "hdnIndex" + ID
});
m_hdnIndex.Call("setValue", JRawValue.From("#{" + m_grid.ID + "}.store.currentPage"));
}


but Change event (hidden field) fired after OnLoad event (window), anyone know how resolve?

Daniil
Nov 25, 2014, 1:07 PM
Hi @multimediait,


is there a way to get a page index (pagingtoolbar) in OnLoad event of Window?

You mean this doesn't work in the OnLoad event?

X.GetCmp<Hidden>("hdnIndex" + ID).Value

Yes, it is not going to work at initial request. X.GetCmp should be used during a DirectEvent/DirectMethod only.


I need get this value to create columns, model is dynamic (database source).

Please clarify how do you use the PageIndex here?

Actually, I don't quite understand the requirement. Initially, the page index is usually 1. It might be not 1 in your scenario?

If you can demonstrate the scenario with a test case, we would appreciate.

multimediait
Nov 28, 2014, 7:03 AM
Hi Daniil, thanks for your quick answer, I resolved my problem with this example:

http://examples2.ext.net/#/GridPanel/Data_Presentation/Meta_config/

In practice, I needed to get a pagingtoolbar index in OnLoad event of dynamic window (within dynamic gridpanel and dynamic pagingtoolbar), to open a recorset.
You can mark this thread with CLOSED.