You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by JS <jy...@yahoo.co.uk> on 2006/11/16 10:26:02 UTC

t:dataTable input

Hi,

I have datatable with rows adding dynamically with inputText. I cannot get
the value entering into input text field. 

Here is my code :


<t:dataTable value="#{TSKBean.workQtDetail}" var="wkQtDetail"
columnClasses="columnStyle" border="0" columnClasses="dataColm1,dataColm2"
preserveDataModel="false"
rowGroupStyle="border-bottom:gold;border-bottom-style:solid;border-bottom-width:2px;vertical-align:top"
preserveRowStates="true"><t:column groupBy="true"><f:facet
name="header"><h:outputText id="dpt" value="#{msg.dept}"
/></f:facet><h:outputText id="dept" value="#{wkQtDetail.deptSelected}"
/><h:inputHidden id="dptId"
value="#{wkQtDetail.deptId}"/></t:column><t:column><f:facet
name="header"><h:outputText id="workQtDetail" value="#{msg.work_qt_detail}"
/></f:facet><h:outputText id="wk" value="#{wkQtDetail.work}"
/><h:inputHidden id="wId"
value="#{wkQtDetail.workId}"/></t:column><t:column><f:facet
name="header"><h:outputText id="effort" value="#{msg.eft}"
/></f:facet><h:inputText id="qtEffort"
value="#{wkQtDetail.qtOfEffort}"/></t:column></t:dataTable> 



I tried putting bean in session scope. But that didn't change .

Please please help me to sort why the input data is not getting. 

Thanks,
~J
-- 
View this message in context: http://www.nabble.com/t%3AdataTable-input-tf2641794.html#a7374241
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: t:dataTable input

Posted by JS <jy...@yahoo.co.uk>.
ohh do I need to set like 
if(workQtDetail  ==null) {
workQtDetail  = new ArrayList();
}



JS wrote:
> 
> ok. Then how can I access the updated workQtDetail list ? and qtOfEffort
> value ?  Please tell me where I am going wrong in this ?
> Thanks,
> JS.
> 
> 
> Nebinger, David wrote:
>> 
>>> Sure. I will 
>>> In the action method I am getting the getWorkQtDetail()  list 
>>> and when I
>>> iterate it , I can see that the qtOfEffort is not getting the 
>>> new value. 
>>> 
>>> public void actionMethod {
>>> for(Iterator itr=getWorkQtDetail()  .iterator();itr.hasnext();)
>>> WorkQuoteDetail key = (WorkQuoteDetail ) itr.next();
>>> Logger.getLog().debug("qtOfEffort : "+key.getQtOfEffort()); 
>>> // here i should
>>> get the updated value. but am not.
>>> }
>> 
>> Okay, well here's your whole problem.
>> 
>> getWorkQtDetail() returns a new list every time, so the actionMethod of
>> course always will find that qtOfEffort is 0.0.
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/t%3AdataTable-input-tf2641794.html#a7390267
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: t:dataTable input

Posted by JS <jy...@yahoo.co.uk>.
ok. Then how can I access the updated workQtDetail list ? and qtOfEffort
value ?  Please tell me where I am going wrong in this ?
Thanks,
JS.


Nebinger, David wrote:
> 
>> Sure. I will 
>> In the action method I am getting the getWorkQtDetail()  list 
>> and when I
>> iterate it , I can see that the qtOfEffort is not getting the 
>> new value. 
>> 
>> public void actionMethod {
>> for(Iterator itr=getWorkQtDetail()  .iterator();itr.hasnext();)
>> WorkQuoteDetail key = (WorkQuoteDetail ) itr.next();
>> Logger.getLog().debug("qtOfEffort : "+key.getQtOfEffort()); 
>> // here i should
>> get the updated value. but am not.
>> }
> 
> Okay, well here's your whole problem.
> 
> getWorkQtDetail() returns a new list every time, so the actionMethod of
> course always will find that qtOfEffort is 0.0.
> 
> 

-- 
View this message in context: http://www.nabble.com/t%3AdataTable-input-tf2641794.html#a7390238
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: t:dataTable input

Posted by JS <jy...@yahoo.co.uk>.
Sure. I will 
In the action method I am getting the getWorkQtDetail()  list and when I
iterate it , I can see that the qtOfEffort is not getting the new value. 

public void actionMethod {
for(Iterator itr=getWorkQtDetail()  .iterator();itr.hasnext();)
WorkQuoteDetail key = (WorkQuoteDetail ) itr.next();
Logger.getLog().debug("qtOfEffort : "+key.getQtOfEffort()); // here i should
get the updated value. but am not.
}

Thanks,
JS.


Nebinger, David wrote:
> 
>> I am not using the UIData object. I 
>> am not whether I have written write code for that.
>> Here is my backing bean method corrsponding
>> the above jsp:
> 
> Well, first you are using a UIData object (it is inferred via the use of
> the <h:dataTable> tag).
> 
> The list that you return (being constructed on the fly) is managed by the
> UIData table, and upon form submit each of the WorkQuoteDetail instances
> that are part of that UIData object will be updated, and I think they are
> updated.
> 
> The part that is missing from your code submission is how you are checking
> the value of qtOfEffort to determine if it has been changed or not; can
> you provide that snippet?
> 
> 

-- 
View this message in context: http://www.nabble.com/t%3AdataTable-input-tf2641794.html#a7389873
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: t:dataTable input

Posted by JS <jy...@yahoo.co.uk>.
No, I haven't got any validation errors.  I have initialised qtOfEffort(in
the datatable input ) in wkQtDetail  as 0.0. So in the backing bean I am
getting as 0.0 as well. I am not using the UIData object. I am not whether I
have written write code for that.Here is my backing bean method corrsponding
the above jsp:

public List getWorkQtDetail() throws ServiceException {                 
workQtDetail = new ArrayList();        WorkQuoteDetail workQt;        List
depts = WorkBasedQtFacade.getDeptByQtNo(qtDetail.getQuoteNo());               
for (int i=0;i<depts.size();i++) {             Object key = depts.get(i);            
//WorkQuoteDetail workQt = new WorkQuoteDetail();               Department
dept = DeptFacade.getById(Integer.parseInt(key.toString())); // getting from
db             List works =
WorkBasedQtFacade.getWorkByQtNo(qtDetail.getQuoteNo(),dept.getDeptId());//getting
from db                          for (int j=0;j<works.size();j++) {            
Object w = works.get(j);             Work work =
WorkFacade.getById(Integer.parseInt(w.toString()));             workQt = new
WorkQuoteDetail(dept.getDeptNm(),work.getWorkNm(),                    
Integer.parseInt(key.toString()),Integer.parseInt(w.toString()));            
workQtDetail.add(workQt);            
getSelectItems().put(dept.getDeptNm(),work.getWorkNm());             }       
}        return workQtDetail;    }
.....................................................................................................................................................................
public class WorkQuoteDetail implements Serializable{        private String
work = null;        private String deptSelected = null;    private double
qtOfEffort = 0.0;          private int deptId = 0;    private int workId =
0;        /** Creates a new instance of WorkQuoteDetail */    public
WorkQuoteDetail(String deptSelected,String work,int deptId,int workId) {       
this.deptSelected = deptSelected;        this.work = work;       
this.deptId = deptId;        this.workId = workId;    }     public String
getWork() {        return work;    }     public void setWork(String work) {       
this.work = work;    }     public String getDeptSelected() {        return
deptSelected;    }     public void setDeptSelected(String deptSelected) {       
this.deptSelected = deptSelected;    }    public double getQtOfEffort() {       
return qtOfEffort;    }     public void setQtOfEffort(double qtOfEffort) {       
this.qtOfEffort = qtOfEffort;    }         public int getDeptId() {       
return deptId;    }     public void setDeptId(int deptId) {       
this.deptId = deptId;    }     public int getWorkId() {        return
workId;    }     public void setWorkId(int workId) {        this.workId =
workId;    }}
....................................................................................................................................................................
Could you please tell me your thoughts on it. Please help me. 

Thanks,
JS.



Nebinger, David wrote:
> 
>> Sorry if I was unclear. Backing bean is not getting updated. 
> 
> The UIData object that is backing the <h:dataTable> would be updated upon
> submit, therefore the list itself (with each individual wkQtDetail
> instance) should also be updated.
> 
> Have you checked to see if you're getting any validation errors generated
> as part of the submit?
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/t%3AdataTable-input-tf2641794.html#a7389429
Sent from the MyFaces - Users mailing list archive at Nabble.com.


RE: t:dataTable input

Posted by JS <jy...@yahoo.co.uk>.
Sorry if I was unclear. Backing bean is not getting updated. 
I am using my faces datatable with grouping row facility. In the datatable I
need to use a input text to provide the user to enter values and when press
button it should get in the backing bean and so that i can update the
database. I can get the value in the backing bean from an input text field
outside the datatable.But when it comes inside it doesn't ! 
Am I clear ? If am not please tell me . I shall post the bean code as well.

Thanks,
JS.




Nebinger, David wrote:
> 
>> > I have datatable with rows adding dynamically with 
>> inputText. I cannot get
>> > the value entering into input text field. 
> 
> What do you mean you cannot get the value?  You're trying to access it
> directly, or the backing bean is not being updated, or what?
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/t%3AdataTable-input-tf2641794.html#a7388693
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: t:dataTable input

Posted by JS <jy...@yahoo.co.uk>.
Me again. Any one have a thought about my problem ? Please respond


JS wrote:
> 
> Hi,
> 
> I have datatable with rows adding dynamically with inputText. I cannot get
> the value entering into input text field. 
> 
> Here is my code :
> 
> 
> <t:dataTable value="#{TSKBean.workQtDetail}" var="wkQtDetail"
> columnClasses="columnStyle" border="0" columnClasses="dataColm1,dataColm2"
> preserveDataModel="false"
> rowGroupStyle="border-bottom:gold;border-bottom-style:solid;border-bottom-width:2px;vertical-align:top"
> preserveRowStates="true"><t:column groupBy="true"><f:facet
> name="header"><h:outputText id="dpt" value="#{msg.dept}"
> /></f:facet><h:outputText id="dept" value="#{wkQtDetail.deptSelected}"
> /><h:inputHidden id="dptId"
> value="#{wkQtDetail.deptId}"/></t:column><t:column><f:facet
> name="header"><h:outputText id="workQtDetail"
> value="#{msg.work_qt_detail}" /></f:facet><h:outputText id="wk"
> value="#{wkQtDetail.work}" /><h:inputHidden id="wId"
> value="#{wkQtDetail.workId}"/></t:column><t:column><f:facet
> name="header"><h:outputText id="effort" value="#{msg.eft}"
> /></f:facet><h:inputText id="qtEffort"
> value="#{wkQtDetail.qtOfEffort}"/></t:column></t:dataTable> 
> 
> 
> 
> I tried putting bean in session scope. But that didn't change .
> 
> Please please help me to sort why the input data is not getting. 
> 
> Thanks,
> ~J
> 

-- 
View this message in context: http://www.nabble.com/t%3AdataTable-input-tf2641794.html#a7383628
Sent from the MyFaces - Users mailing list archive at Nabble.com.