استخدام وظيفة OnAjaxCallFinishedClient في GridWeb

سيناريوهات الاستخدام الممكنة

OnAjaxCallFinishedClientFunction هي وظيفة من جانب العميل تسمى عندما ينسخ المستخدم بعض البيانات إلى ورقة عمل GridWeb. هذه الوظيفة مفيدة عندما يتم تحديث الجزء الأكبر من الخلايا وتريد تتبع تلك الخلايا المحدثة من جانب العميل (على سبيل المثال في متصفحات الويب مثل FireFox و Google Chrome وما إلى ذلك).

استخدام وظيفة OnAjaxCallFinishedClient في GridWeb

يوضح نموذج التعليمات البرمجية التالي كيفية الاستفادة من وظيفة العميل OnAjaxCallFinishedClientFunction. تُظهر لقطات الشاشة إخراج وحدة التحكم في Google Chrome و FireFox عند تنفيذ الكود. بمجرد تنفيذ التعليمات البرمجية ، يرجى نسخ / لصق بعض البيانات التي تمتد عبر خلايا متعددة داخل ورقة عمل GridWeb ثم التحقق من وحدة تحكم متصفح الويب كما هو موضح في لقطات الشاشة.

Google إخراج وحدة تحكم كروم

ما يجب القيام به: image_بديل_نص

إخراج وحدة تحكم FireFox

ما يجب القيام به: image_بديل_نص

عينة من الرموز

 //-------------------------------------------------------

//------TestGridWeb.aspx---------------------------------

//-------------------------------------------------------

//

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestGridWeb.aspx.cs" Inherits="TestGridWeb" %>

<%@ Register TagPrefix="acw" Namespace="Aspose.Cells.GridWeb" Assembly="Aspose.Cells.GridWeb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Test GridWeb</title>

    <script type="text/javascript">



    var updateCells = new Array();



    function TestAjaxCallFinish()

    {

        for (var i = 0; i < updateCells.length; i++) {

            console.log("updated:" + toString(this,updateCells[i]));

        }

        updateCells = [];

    }

    function CellUpdate(cell) {

        var id = updateCells.length;

        updateCells[id++] = cell;

    }

    function toString(gridweb,cell) {

        return gridweb.getCellName(cell) +

            ",value is:" +

            gridweb.getCellValueByCell(cell) +

            " ,row:" +

            gridweb.getCellRow(cell) +

            ",col:" +

            gridweb.getCellColumn(cell);

    }

</script>

</head>

<body>

    <form id="form1" runat="server">

        <div>

            <div>

                <b>GridWeb Version:&nbsp </b>

                <asp:Label ID="lblVersion" runat="server" Text="Label"></asp:Label>

                <br />

            </div>

            <acw:GridWeb ID="GridWeb1" runat="server" XhtmlMode="True" Height="504px" Width="1119px" EnableAJAX="true" OnAjaxCallFinishedClientFunction="TestAjaxCallFinish" OnCellUpdatedClientFunction="CellUpdate">

            </acw:GridWeb>

        </div>

    </form>

</body>

</html>

//-------------------------------------------------------

//------TestGridWeb.aspx.cs------------------------------

//-------------------------------------------------------

//

using System;

using System.Web.UI;

using Aspose.Cells.GridWeb;

public partial class TestGridWeb : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        if (Page.IsPostBack == false && this.GridWeb1.IsPostBack == false)

        {

            lblVersion.Text = GridWeb.GetVersion();

        }

    }

}