DataTable and dynamic Criterias

So i have a problem i might be a bug or that i just don't understand how it works.

I have a Screen and in that screen there are a bunch of Pane and in one of them i have a DataTable that i want to show requests based on a specific String in a extra Column in the ticket table.

I choose the Request table in the table field in the DataTable Element.

So there was no problem showing all the tickets in the DataTable, check 1.

Then i added this in the single values tab on the DataTable element to get only the request i wanted to in the DataTable:

criteria.0.field = ticket.x_myextrafield
criteria.0.indent = 0
criteria.0.operator = OperatorEquals
criteria.0.rowOperator = OperatorAnd
criteria.0.value = helloworld
criteria.length = 1

This also worked, i only got the requests that hade helloword in x_myextrafield check 2.

But now i need to set that value dynamically, and doing it with like HtmlElement.setFieldValue or setValue doesn’t as far as i understand.

So i tried doing in with the callbackInit function and added the following function in the Body tab of the DataTable element.

So first i just tried to do it with a static value:

Void init(SearchEngine se)
{
// Here you can manipulate the SearchEngine as you like.
se.addCriteria("ticket.x_myextrafield", "OperatorEquals", "helloworld", "OperatorAnd", 0);
}

And that worked, somewhat...

I got the rows, but no data...
Didn't think much of it, so i tried to put it as i really wanted it:

Void init(SearchEngine se)
{
// Here you can manipulate the SearchEngine as you like.
se.addCriteria("ticket.x_hertz_ra_nr", "OperatorEquals", getCgiVariable("myextradata"), "OperatorAnd", 0);
}

Same problem here, i get the rows i wanted, but no data.

I do get ticket.id because the link works, so when i click in the row i get to that specific Request in the request screen, so ticket.id must be there some how but there is no data populated in the Fields.

So what is the problem.

Is it that I HAVE to use the Simple values to choose the fields in the DataTable and then add the fields in the init to the SearchEngine to be able to see the values?

Or is there another way to dynamocally filter a data table?

Or is this a bug, or is there anything more you have to do?

I would like to have the Check 3... because that would mean my Screen is done, ready, finished...

How can it always be that last litle thing that you can't solve is just that last thing you did...

/Ronny

RE: DataTable and dynamic Criterias

Hmm, no this is not a bug.

I just didn't get the fakti that if you use the callback function you NEED to use both the of the, callbackDisplay and callbackInit.

If you don't the data is not put in to the cells in your DataTable.

But after doing some 50-100 rows of ejScripting i got it working, since you get the data directly from the database you need to say find e.g. the Category name, Customer name, Status name and so on,

But the good part is now that it works.

It took awile but the hard work payed off.

 

/Ronny

Av: Ronny Eriksson 25. jan 2012