ShihMingSyu / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

Struts jquery Grid onSelectRowTopics topic is publish multiple times #811

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
(This is for feature requests and bugs in Struts2 jQuery Plugin - for
getting help, please use the User Group.
http://groups.google.com/group/struts2-jquery )

My struts jquery Grid  is as follows :

<sjg:grid id="gridTestCase"
        caption="%{getText('label.gridManualTestCases')}" dataType="json"
        pager="true" page="1" gridModel="gridModel"
        onSelectRowTopics="rowselected" rowList="10,20,30,40" rowNum="10"
        rownumbers="true" navigator="true" width="660" navigatorSearch="true"
        navigatorView="false" multiselect="false" navigatorAdd="false"
        navigatorEdit="false" navigatorDelete="false" viewrecords="true"
        navigatorSearchOptions="{multipleSearch:true}"
        footerrow="true" cssStyle="{font-size: 10px;}" onCompleteTopics="completed">

        <sjg:gridColumn name="manualTestCase.manualTestCaseID"
            index="manualTestCase.manualTestCaseID"
            title="%{getText('label.ID')}" tooltip="configure" key="true"
            sortable="true" editable="false" edittype="text" key="true"
            hidden="true" />

        <sjg:gridColumn name="manualTestCase.manualTestCaseName"
            index="manualTestCase.manualTestCaseName" key="true"
            title="%{getText('label.gridManualTestCaseName')}" sortable="false"
            editable="false" edittype="text" />

        <sjg:gridColumn name="manualTestCase.description"
            index="manualTestCase.description"
            title="%{getText('label.gridManualTestCaseDescription')}" key="true"
            editable="true" hidden="true" edittype="text" id="link123"
            href="%{editurl}" required="true" width="250" />

        <sjg:gridColumn name="entitystatus.statusName"
            index="entitystatus.statusName"
            title="%{getText('label.ManualExecStatus')}" key="true"
            editable="true" hidden="false" edittype="text" id="link123"
            href="%{editurl}" required="true" width="100" />

    </sjg:grid>

i have written following code for subscribing "rowselected" topic

$.subscribe('rowselected', function(event, ref) { alert('xyz');  // some code}

on selecting any row in grid(single click) .... the function inside subscribe 
gets call multiple times.

What is the expected output? What do you see instead?

function shld get call only once. alert(xyz) shld get call only once

Which struts2 version?
struts2-core 2.1.8.1

Which struts2-jquery plugin version?
struts2-jquery-plugin 2.5.1
struts2-jquery-grid-plugin 2.5.1

Please provide any additional information below.

Original issue reported on code.google.com by pritam27...@gmail.com on 27 Apr 2012 at 2:56

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 27 Apr 2012 at 4:31

GoogleCodeExporter commented 9 years ago
where do you have placed your $.subscribe ? Be sure this is only executed once.

Original comment by johgep on 4 May 2012 at 11:29