简体   繁体   English

从具有列作为输入字段的数据表中获取行数据

[英]Get Row Data from Data table having a column as input field

I have a datatable having a column with an input field.我有一个数据表,其中有一列带有输入字段。 To get the data from table I'm using:要从我正在使用的表中获取数据:

table.rows().data().toArray();

Im getting the result array, but for the column with input field I'm getting the whole html of input field and not just the value.我得到了结果数组,但是对于带有输入字段的列,我得到了输入字段的整个 html 而不仅仅是值。 eg.例如。 '<input type="text" value="someValue"></input>'

How can I manipulate the code to get the value of input in result Array.如何操作代码以获取结果数组中的输入值。 TIA. TIA。

table
  .rows()
  .data()
  .toArray()
  .map((el) => {
   if(el.includes('<input')){
    return el.split('value="')[1].split('"')[0]
   }
  })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM