Access ID of a cell inside a table

How can I access ID of a cell of a table. Let's say I've a table, and I click one element. I want to access other cells present in the same row. How can I do so?

Is it a table, Tablelist or tablerecords ?

What do you want to access, data or html attributes?

It is a table list in one case and table record in another, and I want to access the html attribute. 

Thanks.

I was hoping tablelist and data... 


Since ID's are created by Outsystems i don't think you can access them.

You could alter attribute with extended properties and make them depend on your current data.

Hope this is helpfull for you.

Hi you can access them, but as Stefano already mentioned the ids are generated by OutSystems, so you are a bit out of control over how they are named or (renamed).

As an alternative you can added as Stefano also already mentioned an extended property  to uniquely identify each cell within each row with a custom html tag:

Also remember the table records widget is rendered as a HTML table:

So you can use Jquery or Javascript functions to navigate the dom and access all table values.

Regards,

Daniel

Hi Sumit Kumar

Are you trying to implement any JavaScript function here ? As stefano indicated,ids are auto generated 

There is one solution which I have used in some situations .You wrap each column elements in a container and use class instead of id to get the element , but this I have implemented in my jquery function. 

If you can explain what exactly you are trying to implement , then may be we can provide some hint.


Stefano Valente wrote:

I was hoping tablelist and data... 


Since ID's are created by Outsystems i don't think you can access them.

You could alter attribute with extended properties and make them depend on your current data.

Hope this is helpfull for you.


Really helpful, but how to do so? Do we use the extended properties? Can you give me an example?

Daniel Kuhlman gave a perfect example how to do it. You only need some JQuery to access it. 

Perhaps Pranav can provide that?


Would be a nice team effort ;)

pranav pandey wrote:

Hi Sumit Kumar

Are you trying to implement any JavaScript function here ? As stefano indicated,ids are auto generated 

There is one solution which I have used in some situations .You wrap each column elements in a container and use class instead of id to get the element , but this I have implemented in my jquery function. 

If you can explain what exactly you are trying to implement , then may be we can provide some hint.


Hey Pranav,

I'm trying to make a text, which is in a td, visible on click of a checkbox which is in another td, of the same row. I don't want all the texts to be visible, only the one's checked, so do you think class can be helpful, because I'm new to the technology. I can always use some ways around. :)

Stefano Valente wrote:

Daniel Kuhlman gave a perfect example how to do it. You only need some JQuery to access it. 

Perhaps Pranav can provide that?


Would be a nice team effort ;)


So to acces the JQuery, I need some selector, right? How do I get that?

Sumit Kumar wrote:

pranav pandey wrote:

Hi Sumit Kumar

Are you trying to implement any JavaScript function here ? As stefano indicated,ids are auto generated 

There is one solution which I have used in some situations .You wrap each column elements in a container and use class instead of id to get the element , but this I have implemented in my jquery function. 

If you can explain what exactly you are trying to implement , then may be we can provide some hint.


Hey Pranav,

I'm trying to make a text, which is in a td, visible on click of a checkbox which is in another td, of the same row. I don't want all the texts to be visible, only the one's checked, so do you think class can be helpful, because I'm new to the technology. I can always use some ways around. :)

Ah, this makes it way more easy.  Your rows datalist need to have a boolean variable, for example: IsShowText. The checkbox will use that variable and a container or your td should have style and if(isShowText,"","display:none" in the extended properties.


don't forget the ajax refresh...


    table.find('tr').each(function (i, el) {
        var $tds = $(this).find('td'),
            productId = $tds.eq(0).text(),
            product = $tds.eq(1).text(),
            Quantity = $tds.eq(2).text();
        // do something with productId, product, Quantity
    });

http://jsfiddle.net/bqX7Q/


I created the IsShowText in the aggregate i sue to populate the tablerecords.This Style property i set in the column. I think its best to put it in a div inside that Td.

Stefano Valente wrote:

Sumit Kumar wrote:

pranav pandey wrote:

Hi Sumit Kumar

Are you trying to implement any JavaScript function here ? As stefano indicated,ids are auto generated 

There is one solution which I have used in some situations .You wrap each column elements in a container and use class instead of id to get the element , but this I have implemented in my jquery function. 

If you can explain what exactly you are trying to implement , then may be we can provide some hint.


Hey Pranav,

I'm trying to make a text, which is in a td, visible on click of a checkbox which is in another td, of the same row. I don't want all the texts to be visible, only the one's checked, so do you think class can be helpful, because I'm new to the technology. I can always use some ways around. :)

Ah, this makes it way more easy.  Your rows datalist need to have a boolean variable, for example: IsShowText. The checkbox will use that variable and a container or your td should have style and if(isShowText,"","display:none" in the extended properties.


don't forget the ajax refresh...


Hey Stefano, 

I don't want to Ajax refresh. I don't want to send a request to server every time a checkbox is checked or unchecked. Assuming I've 1000 checkboxes and I want to select lets say some 200 checkboxes, should I carry the overhead of 200 ajax?


@Daniel:

Ajax refresh doesnot send requests to the server am i right?

How about changing a value in an aggregate without refreshing data? 


I don't think this will give any overhead, but i do want to check this with Daniel.

Ajax refresh WILL send request to server including complete viewstate. So you have to try and use as less as possible Ajax refresh.

See  https://success.outsystems.com/Documentation/11/Developing_an_Application/Implement_Application_Logic/Use_Ajax_to_Refresh_Part_of_a_Screen