Changing Jquery FlexGrid's data

给你一囗甜甜゛ 提交于 2019-12-23 03:25:15

问题


I am having a flex grid. I need to change the data which is showing in that.

In $(document).ready() I am calling a function and I am getting the result.Now what i want is to get data from db using another query.So I just made a function, in that i am adding the needed values to fetch the data in the url.This function is calling when I click a button .But the request is not going .So that is not changing.Please Help me. Thanks

 $(document).ready(function() {

            getAllData(); //first call

            $(".datebetweenList").click(function() {

                    getDataBetweenDates(); //secondcall change in url


     });     
    });


// Calls First
  function getAllData() {

            $("#flex1").flexigrid

                    ({
                        url: '../Handlers/AjaxGetData.ashx?isFlexi=<%=Request.QueryString["ass"]%>&bid=' + document.getElementById("<%=ddlBranch.ClientID%>").value,
                        dataType: "json",
                        colModel: [

                    { display: 'Sl No', name: 'SlNo', width: 10, hide: true, sortable: false, align: 'center' },
                    { display: 'Sl No', name: 'SlNo', width: 60, sortable: false, align: 'center' },
                    { display: 'Code', name: 'asset_Code', width: 180, sortable: true, align: 'left' },
                    { display: 'Name', name: 'asset_Name', width: 150, sortable: true, align: 'left' },
                    { display: 'Serial No', name: 'asset_Sl_No', width: 150, sortable: true, align: 'left' },
                    { display: 'Category', name: 'asset_Category', width: 150, sortable: true, align: 'left' },
                    { display: 'Location', name: 'location_Name', width: 150, sortable: true, align: 'left' },
                    { display: 'Qty', name: 'qty', width: 150, sortable: true, align: 'left' },
                    { display: 'Status', name: 'status', width: 150, sortable: true, align: 'left' },
                    { display: 'Report', name: 'Report', width: 150, sortable: false, align: 'left' }
                    ],
                        buttons: [

                    ],
                        searchitems: [

                    { display: 'Asset Name', name: 'asset_Name' }

                    ],
                        sortname: "asset_Name",
                        sortorder: "asc",
                        usepager: true,
                        singleSelect: true,
                        title: "Asset Stock Report",
                        useRp: true,
                        rp: 15,
                        showTableToggleBtn: true,
                        width: 1240,
                        height: 200
                    });


        }

//Calls Second [on clicking a button]
        function getDataBetweenDates() {
            $("#flex1").flexigrid

                    ({
                        url: '../Handlers/AjaxGetData.ashx?isFlexi=<%=Request.QueryString["ass"]%>&bid='
                         + document.getElementById("<%=ddlBranch.ClientID%>").value + '&isDate=1&eDate=' +
                         document.getElementById("<%=txtEndDate.ClientID%>").value +
                         '&sDate=' + document.getElementById("<%=txtStartDate.ClientID%>").value,
                        dataType: "json",
                        colModel: [

                    { display: 'Sl No', name: 'SlNo', width: 10, hide: true, sortable: false, align: 'center' },
                    { display: 'Sl No', name: 'SlNo', width: 60, sortable: false, align: 'center' },
                    { display: 'Code', name: 'asset_Code', width: 180, sortable: true, align: 'left' },
                    { display: 'Name', name: 'asset_Name', width: 150, sortable: true, align: 'left' },
                    { display: 'Serial No', name: 'asset_Sl_No', width: 150, sortable: true, align: 'left' },
                    { display: 'Category', name: 'asset_Category', width: 150, sortable: true, align: 'left' },
                    { display: 'Location', name: 'location_Name', width: 150, sortable: true, align: 'left' },
                    { display: 'Qty', name: 'qty', width: 150, sortable: true, align: 'left' },
                    { display: 'Status', name: 'status', width: 150, sortable: true, align: 'left' },
                    { display: 'Report', name: 'Report', width: 150, sortable: false, align: 'left' }
                    ],
                        buttons: [

                    ],
                        searchitems: [

                    { display: 'Asset Name', name: 'asset_Name' }

                    ],
                        sortname: "asset_Name",
                        sortorder: "asc",
                        usepager: true,
                        singleSelect: true,
                        title: "Asset Stock Report",
                        useRp: true,
                        rp: 15,
                        showTableToggleBtn: true,
                        width: 1240,
                        height: 200
                    });

        }

回答1:


I got the answer.

We can able to pass the value in option

  $('#flex1').flexOptions({ url: 'a.apsx'?id=1'
            }).flexReload();


来源:https://stackoverflow.com/questions/5064493/changing-jquery-flexgrids-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!