วิธีรับค่าเซลล์ที่เลือกใน Iframe ใน mxGraph

เราจะรับค่าเซลล์ที่เลือกในเฟรมได้อย่างไร? ฉันโทรไปที่ iframe โดยคลิกลิงก์ และใน Iframe ฉันต้องการรับค่าแอตทริบิวต์ของเซลล์ที่เลือก

 <script>
        function main(container) {
            if (!mxClient.isBrowserSupported()) {
                mxUtils.error('Browser is not supported!', 200, false);
            }
            else {
                var graph = new mxGraph(container);
                var cell = graph.getSelectionCell();
            }
  </script>

<body onload="main(window.parent.document.getElementById('graphContainer'))">
    <form id="form1" runat="server">

    </form>
</body>

person Ashfaq Shaikh    schedule 24.12.2012    source แหล่งที่มา
comment
iFrame อยู่บนโดเมนเดียวกันหรือไม่ คุณช่วยแสดงการตั้งค่า HTML ของคุณให้เราดูหน่อยได้ไหม .. บางทีอาจเป็นตัวอย่าง jsfiddle.net ?   -  person Manse    schedule 24.12.2012
comment
ใช่ Iframe อยู่ในโดเมนเดียวกัน   -  person Ashfaq Shaikh    schedule 24.12.2012


คำตอบ (1)


หากคุณกำลังใช้บางอย่างเช่นปุ่ม

คุณสามารถรับข้อมูลส่วนใหญ่ที่คุณกำลังมองหาได้จาก evt

ตัวอย่างเช่น:

    graph.addListener(mxEvent.DOUBLE_CLICK, function(sender, evt)
    {
        var cell = evt.getProperty('cell');
        if (cell != null && cell.parent != main_class) {
                main_class = cell.edges[0].value.slice(14, cell.edges[0].value.indexOf('-') );

ฯลฯ....

เห็นได้ชัดว่าคุณสามารถใช้ดีบักเกอร์ใน Firefox เพื่อพิจารณาว่าคุณสมบัติที่คุณกำลังมองหาอยู่ที่ใดในอนุกรมวิธาน

person rafirosenberg    schedule 01.11.2013