extjs 怎样从数据库或后台中获取值给form填充默认值

extjs 怎样从数据库或后台中获取值给form填充默认值,第1张

用qsqltablemodel的insetrow()、setdata()、submitall()函数实现增;

 officeTable->insertRow(0);

 officeTable->setData(officeTable->index(0, 0), row);

 officeTable->setData(officeTable->index(0, 1), newWnd->imageFileEditor->currentIndex());

 officeTable->setData(officeTable->index(0, 2), newWnd->locationText->text());

 officeTable->setData(officeTable->index(0, 3), newWnd->countryText->currentText());

 officeTable->setData(officeTable->index(0, 4), newWnd->descriptionEditor->toPlainText());

 officeTable->submitAll();

用removerow()、submitall()函数实现删;

 int officeCount = officeTable->rowCount();

 officeTable->removeRow(id);

 for(int i = id; i < officeCount - 1;i++)

 {

  officeTable->setData(officeTable->index(i, 0), i);

 }

 officeTable->submitAll();

用QSqlRecord类的setvalue实现改;

  QSqlRecord recordCurrentRow = officeTable->record(id);

  recordCurrentRowsetValue("id", id - 1);

  officeTable->setRecord(id - 1, recordCurrentRow);

  officeTable->submitAll();

用QSqlRecord类的value进行比较实现查;

int Dialog::findArtistId(const QString &artist)

{

    QSqlTableModel artistModel = model->relationModel(2);

    int row = 0;

    while (row < artistModel->rowCount()) {

        QSqlRecord record = artistModel->record(row);

        if (recordvalue("artist") == artist)

            return recordvalue("id")toInt();

        else

            row++;

    }

    return addNewArtist(artist);

}

以上就是关于extjs 怎样从数据库或后台中获取值给form填充默认值全部的内容,包括:extjs 怎样从数据库或后台中获取值给form填充默认值、怎样用柱状图实现mysql数据库中的数据,现在我不知道怎么将数据库中的数据读取出来显示在柱状图上、java连接到sql server2008数据库添加数据显示索引超出范围等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/9435609.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-28
下一篇2023-04-28

发表评论

登录后才能评论

评论列表(0条)

    保存