如何从数据表中的外部数据更新行?

时间:2017-08-31 16:26:04

标签: jquery grid datatables-1.10

我尝试连续更新某些字段,问题是它不起作用。

  borrar = table.row($(this).parents('tr'));
  var datos = {
    id : $("#id").val(),
    tipo : $("#tipo").val(),
    rol : $("#rol").val(),
    descripcion : $("#descripcion").val(),
    estado : $('#estado').prop('checked')};
  borrar.data()[1] = datos.rol;
  borrar.data()[2] = datos.descripcion;
  console.log(borrar.data()); //(5) ["2", "aaaa", "aaa", "Activo".....
  borrar.invalidate().draw();
  console.log(borrar.data()); //Here return default value (5) ["2", "Fábrica", "Usuario Fábrica del Sistema", "Activo"....

使用DataTables 1.10.12

1 个答案:

答案 0 :(得分:0)

问题解决了:

class MainActivity : Activity() {

var id = 0

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)
    val button:View = findViewById(R.id.button)
    button.setOnClickListener(this::onAddNotification)
}

private fun onAddNotification(v: View) {
    id++
    val builder = Notification.Builder(this).setSmallIcon(R.drawable.ic_notifications_none)
            .setContentTitle("Content #$id").setContentText("Content text for $id")

    val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
    notificationManager.notify(id, builder.build())
}
}

当表基于DOM