on 05-27-2009 12:13 PM
Hello all,
I have implemented the table sorting several times in another developments, but now I'm facing a problem.
I have created the table and context node that I need to sort dinamically (before somebody ask me why, I would say that it's the only way to do that for my current project, there was no possibility of doing that in dessign time). I have implemented the table sorting more or less the same way I would do with a table created in dessing time, but when I run my WD the sorting of columns doesn't work.
In the wdDoModifyView, I have put the following code:
if(firstTime){
....
IWDAction ordenacion = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION, null);
IWDParameters param = ordenacion.getActionParameters();
param.addParameter("nombreNodo",nombreNodo);
...
}
and in the code of the action
{
//@@begin onActionOrdenacion(ServerEvent)
System.err.println("**** NOMBRE NODO **** "+nombreNodo);
wdContext.currentContextElement().getTableSorter().sort(wdEvent, wdContext.getChildNode(nombreNodo, IWDNode.LEAD_SELECTION));
//@@end
}
The name of the node ("nombreNodo) it's only correct the first time I click on a column.
Has anybody implemented the table sorting in a dinamically created table and context node? And how do you do to make it works.
Thank you very much
Hi,
Please check these:
Did you create a context attribute (For example: TableSorter) and chage the type of this attribute to the TableSorter java class.
After that you need to write this below code in wdDoModifyView method.
IWDTable table = (IWDTable) view.getElement("Table");
wdContext.currentContextElement().setTableSorter(
new TableSorter(table, ordenacion , null));
Regards,
Charan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you check that every time
wdContext.getChildNode(nombreNodo, IWDNode.LEAD_SELECTION)); is returning the proper node.
And
I guess you created this action OrdenAction before writing the piece of code.
IWDAction ordenacion=
wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION, null);
So why dont you change the code as below
IWDAction ordenacion=wdThis.wdGetOrdenAction();
Regards,
Charan
Hi,
sorry, I couldn't answer before.
I have done what you have said me, change
IWDAction ordenacion = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION, null);
for
IWDAction ordenacion=wdThis.wdGetOrdenacionAction();
Also I have checked the name of the node selected with
wdContext.getChildNode(nombreNodo, IWDNode.LEAD_SELECTION);
The first time I clicked on a column the name of the node is correct, from so on a null is returned. Also I have stated that when I clicked on the arrows of a column, the arrows dissappaered.
Here is the code
//Preparamos Navegaciones
IWDAction abrirProyecto = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ABRIR_PROYECTO, null);
IWDAction abrirDisp = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ABRIR_DISPONIBLE, null);
//IWDAction ordenacion = wdThis.wdCreateAction(IPrivateResultDispGlobalView.WDActionEventHandler.ORDENACION, null);
IWDAction ordenacion=wdThis.wdGetOrdenacionAction();
IWDParameters param = ordenacion.getActionParameters();
param.addParameter("nombreNodo",nombreNodo);
IWDTable table = wdThis.wdGetInformesController().crearTabla(view, nombreNodo, movimientosInfo,new String[]{"Codi Projecte",null,"Nom Projecte", "Import Projecte", "Client", "Increment Disponible futur per facturació no emesa i / o anualitats pendents","Increment Disponible futur per ingressos pendents de cobrar", "Disponible"},new String[]{"10px", null,"10px", "10px","10px","10px","10px","10px"},new IWDAction[]{abrirProyecto,null, null, null, null,null,null,abrirDisp}, -1);
//ordenar tabla
wdContext.currentContextElement().setTableSorter(new TableSorter(table, ordenacion,null));
containerTablasProyecto.addChild(table);
Edited by: Mireia Romo on May 28, 2009 12:27 PM
Sorry, I can't create the node outside the if(firsTime) because for the complexity of the project I don't know beforehand how many nodes I need to create and if I create it beforehand I get a namingException (duplicate name of the node).
Anyway, the first time I click for sorting the table doesn't work neither.
Edited by: Mireia Romo on May 28, 2009 1:02 PM
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.