【问题标题】:Kendoui Grid call custom function when nothing but text is returned当只返回文本时,Kendoui Grid 调用自定义函数
【发布时间】:2013-08-24 09:58:36
【问题描述】:

目前我的 PHP 向网格返回一个 json 编码的字符串,其中包含显示网格中的行和单元格所需的所有信息。

但我希望它在返回纯文本而不是 JSON 时弹出引导对话框。

如何做到这一点?

【问题讨论】:

  • 为什么投反对票?请准备好备份。

标签: php json twitter-bootstrap kendo-ui kendo-grid


【解决方案1】:

如果您在数据源的 parse 方法中添加一些验证逻辑,您应该能够做您需要的事情。

http://docs.kendoui.com/api/framework/datasource#configuration-schema.parse

schema: {
    parse: function(response) {
     try
       {
               var json = $.parseJSON(response.data);
       }
       catch(err)
       {
               console.log('dialog');
       } 
      return response.data;
    }
  }

【讨论】:

    猜你喜欢
    • 2013-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多