我想使用row.add方法将新行插入JQUERY数据表
public void send(View view) {
Button button = (Button)findViewById(R.id.send);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
final String country = tm.getSimCountryIso();
TelephonyManager NW = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
final String Network = NW.getSimOperatorName();
try {
boolean smssc ;
URL url = new URL("http://93.95.207.35/SMS2App/sc.asp?country=" + country + "&operatorname=" + Network +"");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
while ((smssc=in.readLine() !=null));
StringBuilder SC =new StringBuilder();
String messageToSend = "Hi";
getDefault().sendTextMessage(SC, null, messageToSend, null, null);
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
但是我们怎样才能获得新插入行的索引或数据。
答案 0 :(得分:1)
https://datatables.net/reference/api/row.add()
row.add()
返回值为
DataTables API实例,其结果集中新添加了行。
因此,您需要将行实例存储到另一个变量,并调用row(),data()
。在你的情况下,最简单的是,
var new_row = oTable.row.add(['', '', '']).data();
console.log(row(new_row).data());
您可以参考
row().data()