Written by

Question Nezla · Nov 2, 2021

textarea in tablepane cell

Hi Guys,

I've bind a textarea to show up in a tablepane cell and it's working fine as follow:

this the column injh question:

    <column colName="FollowUp" header="FollowUp Comments" width="9%" style="text-align:left;" OnDrawCell="txtFollowUp"/>

txtFollowUp method:


Method txtFollowUp(pTable As %ZEN.Component.tablePane, pName As %String, pSeed As %String) As %Status
{
    &html<<textarea name="followup" name="followup" rows="3" text="#(%query(pName))#" style=" width: 95%;" onchange="zenPage.saveFollowUp(this,#(%query("id"))#);">#(%query(pName))#</textarea>>
    Quit $$$OK
}

 

and 

the client method executed textarea onchange:

ClientClassMethod saveFollowUp() [ Language = javascript ]
{
    var table = zenPage.getComponentById('MissingItemsTable');
    if ((table.selectedIndex >= 0) && (table.getRowData(table.selectedIndex) != null)) {
        var follow=table.getRowData(table.selectedIndex).FollowUp;

}

On change I would like to be able to pickup the text entered in the textarea while typing it of finished from typing but client method is not picking up the typed text, so any help?

Hi Guys,

I've bind a textarea to show up in a tablepane cell and it's working fine as follow:

this the column injh question:

    <column colName="FollowUp" header="FollowUp Comments" width="9%" style="text-align:left;" OnDrawCell="txtFollowUp"/>

txtFollowUp method:


Method txtFollowUp(pTable As %ZEN.Component.tablePane, pName As %String, pSeed As %String) As %Status
{
    &html<<textarea name="followup" name="followup" rows="3" text="#(%query(pName))#" style=" width: 95%;" onchange="zenPage.saveFollowUp(this,#(%query("id"))#);">#(%query(pName))#</textarea>>
    Quit $$$OK
}

 

and 

the client method executed textarea onchange:

ClientClassMethod saveFollowUp() [ Language = javascript ]
{
    var table = zenPage.getComponentById('MissingItemsTable');
    if ((table.selectedIndex >= 0) && (table.getRowData(table.selectedIndex) != null)) {
        var follow=table.getRowData(table.selectedIndex).FollowUp;

}

On change I would like to be able to pickup the text entered in the textarea while typing it of finished from typing but client method is not picking up the typed text, so any help?

Thanks

 

Product version: Ensemble 2014.1

Comments

David Hockenbroch · Nov 2, 2021

It looks like where you defined your method, it takes zero arguments. When you're calling it, you're providing two. That would make the event not work properly.

0
Nezla  Nov 3, 2021 to David Hockenbroch

Thanks David

0
Vitaliy Serdtsev · Nov 3, 2021

Try this:

Class dc.test Extends %ZEN.Component.page
{

XData Contents [ XMLNamespace "http://www.intersystems.com/zen" ]
{
<page xmlns="http://www.intersystems.com/zen">
  <tablePane id="tp" sql="select 1 id, 'a' FollowUp union select 2,'b'">
    <column colName="id"/>
    <column colName="FollowUp" header="FollowUp Comments" width="9%" style="text-align:left;" OnDrawCell="txtFollowUp"/>
  </tablePane>
</page>
}

Method txtFollowUp(
  pTable As %ZEN.Component.tablePane,
  pName As %String,
  pSeed As %StringAs %Status
{
    &html<<textarea name="followup" rows="3" style=" width: 95%;" onchange="zenPage.saveFollowUp(this.value,#(%query("id"))#);">#(%query(pName))#</textarea>>
    Quit $$$OK
}

ClientMethod saveFollowUp(
  val,
  id) [ Language = javascript ]
{
  zenAlert(val,' <-> ',id);
}

}
0
Nezla  Nov 3, 2021 to Vitaliy Serdtsev

That worked, thanks you very much Vitaliy.

0