显示无结果消息Flexigid

时间:2013-11-14 21:28:43

标签: javascript jquery flexigrid

所以我隐藏了我的Flexigrid,直到有搜索匹配结果。

所以我的flexigrid初始化:

flexigrid({
        url ='myUrl',  
        onSubmit: showFlexigrid(),
        //my other flexigrid options
        });

 function showFlexigrid(celDiv, id) {

        var flexiGrid = $('#gridTablegSearchProperty')

        if (!flexiGrid.is(":visible")) {
            if (id) { //got at least one result if id is not undefined
                $('#flexigridWrapper').show();
            } else {
                //I want to display a no results found message to the user here
                //but this won't work because the showFlexigrid function is
                //not called on flexiReload()
                console.log('no results');
            }
        }
    }

//in my $document.ready my search button click implementation:

 $("#btnSearch").click(function () {
    $('#gridTablegSearchProperty').flexReload();
  });

<!--And my html-->
<div id="flexigridWrapper" style="display:none;">
    <div class="row">
        <div class="col-lg-12">
            <div class="well">
                <div class="well-inner">
                    <table id="gridTablegSearchProperty"></table>
                </div>
            </div>
        </div>
    </div>
</div>

因此,无论是在我的flexigrid“instantiation”中绑定到的flexigrid onSubmit还是onSuccess,都不会调用.flexReload,除非至少在记录中返回。我看不到每次触发的flexigrid选项,甚至onSubmit都没有这样做。

1 个答案:

答案 0 :(得分:0)

我认为您的$(document).ready()中的点击事件存在一些与引号相关的语法问题。看看jQuery style guide for quotes。它写道:&#34;需要内部引用的字符串必须使用双重外部和单个内部。&#34;