I am getting list of objects in JSON response and I am creating dynamic table rows using javascript function. Table doesn't show all of the values for each record, only few columns. When user selects a record in table I don't want to make a server trip to get all attributes of that record from database hence I have fetched all data initially when getting records to be displayed in table. Now on click of a row I want to get this object and display each attribute in form below the table.
My problem is that how to store/bind each record object to respective <tr>
tag and retrieve it on click event as HTML allows to assign only String values to tag attributes.
HTML5 allows custom attributes with "data-" prefix and we can access them using $("idOfTag").data("atrribute_name_after_data-");
but these attributes also accepts only String value.
I know this may not be most efficient way as there are some other solutions as 1. Storing record objects in array and assigning only index to respective tag so at the time of retrieval we get index from event source and get corresponding object from array. 2. Using jqGrid to dynamically create table/grid according to JSON response.