How to change ViewCriteria At runtime
Sometime we get requirement to change the add or remove attribute to query panel at runtime.
This post will help everybody to achieve that functionality.
Idea is just to play around the query-able attribute of viewobject at runtime. you just have to set it true /false.
protected void setQueriable(ViewObject vo, String attributeName, boolean condition) {
// set the attribute queryable as needed
// getting the ELContext from faces context
// get application from faces context
AttributeDef def = vo.getAttributeDef(vo.getAttributeIndexOf(attributeName));
boolean queryable = condition;
// set/reset queriable only if needed
if (def != null && def.isQueriable() != queryable) {
AttributeDefImpl attributeDef = (AttributeDefImpl)def;
attributeDef.setQueriable(queryable);
attributeDef.registerDefObject();
}
}
// set the attribute queryable as needed
// getting the ELContext from faces context
// get application from faces context
AttributeDef def = vo.getAttributeDef(vo.getAttributeIndexOf(attributeName));
boolean queryable = condition;
// set/reset queriable only if needed
if (def != null && def.isQueriable() != queryable) {
AttributeDefImpl attributeDef = (AttributeDefImpl)def;
attributeDef.setQueriable(queryable);
attributeDef.registerDefObject();
}
}
This piece of code it responsible for adding and removing attribute from af:quereyPanel.
Find application source here ChangeCriteriaAtRuntime
I appreciate you sharing this article. Really thank you! Much obliged.
ReplyDeleteThis is one awesome blog article. Much thanks again.
sap online training
software online training
sap sd online training
hadoop online training
sap-crm-online-training
Pretty good post. I just came across your site and wanted to say that I’ve really enjoyed reading your posts. In any case I’ll be subscribing to your feed and I hope you will keep a good work!Cheer!
ReplyDeletesap online training
software online training
sap sd online training
hadoop online training
sap-crm-online-training
This is one awesome blog article. Much thanks again.
ReplyDeleteI really enjoy the blog.Much thanks again. Really Great.
oracle online training
sap fico online training
dotnet online training
qa-qtp-software-testing-training-tutorial
Latest Government Jobs 2016
ReplyDeleteRight place for accurate information.......... keep sharing your views...........
Latest Govt Jobs Notification 2016
ReplyDeleteI have visited this blog first time and i got a lot of informative data from here which is quiet helpful for me indeed..............
Where is this application code ?, i am getting error ChangeCriteriaAtRuntime.rar . can you send me sanjaygouda@gmail.com
ReplyDelete