PDA

View Full Version : DWR -- Spring


astonishingone
May 22nd, 2007, 11:00 AM
Hi ,
I am new to dwr
I am using with spring and hibernate.
Well everything was ok just that the list i retrieve by my dwr remote method got the data in the form of list first time and if i refresh or call the JavaScript function of fillTable again it displays the same data even i manually edit the data in mysql db .
i am using dwr-sping i.e not using dwr.xml
I am using both dwr controller and spring MVC controller
i have debugged that the data at DAO layer (i.e hibernate) is retrieving the correctly but the list object which i get via dwr remote method is getting the same data which it received first time , is this object scoping problem , just guessing .

My main intention is to auto refresh the page using dwr as the data contains more then 15000 plus rows and not to delete and populate as it will give same conventional refresh page effect , i want to first load and then replace / edit the existing data in html table so that if use scroll down after refesh he is not again at first record and also show that data change effect (like changing border color of cell )


I hope i am able to explain the problem

Thanks in advance for your valuable suggestion

pmularien
May 22nd, 2007, 12:37 PM
Well... there are very many people using these two technologies successfully with each other, so it's probably something errant with your code. Please post back with as much code as you feel comfortable sharing, and we'll try to help you out.

astonishingone
May 22nd, 2007, 01:21 PM
Thank pmularien for replying

This was in my spring applicationContext.xml for dwr

<dwr:controller id="dwrController" debug="true" />
<dwr:configuration>
<dwr:convert type="bean" class="iridiumplus.com.kw.model.CompanyMaster" javascript="companyMaster" />
<dwr:convert type="bean" class="iridiumplus.com.kw.model.BuyOrderbook" javascript="buyOrderbook" />
<dwr:convert type="bean" class="iridiumplus.com.kw.model.SellOrderbook" javascript="sellOrderbook" />
<dwr:convert type="bean" class="iridiumplus.com.kw.model.SectorIndex" javascript="sectorIndex" />
<dwr:convert type="bean" class="iridiumplus.com.kw.model.StockQuotes" javascript="stockQuotes" />
<dwr:convert type="bean" class="iridiumplus.com.kw.model.Exchange" javascript="exchange" />
<dwr:convert type="bean" class="iridiumplus.com.kw.model.CompanyType" javascript="companyType" />
<dwr:convert type="bean" class="iridiumplus.com.kw.model.OrderBook" javascript="orderBook" />
</dwr:configuration>


<bean id="orderBookCompanies" class="iridiumplus.com.kw.model.OrderBookCompanies">

<dwr:remote javascript="myAjax">
<dwr:include method="getAllOrderBook" />
</dwr:remote>
<property name="tradeManager" ref="tradeManager"/>
</bean>


In my javaScript

var cellFunctions =[

function(orderBook){return orderBook.tkr; },
function(orderBook){return orderBook.price/10; },
function(orderBook){return orderBook.askCnt;},
function(orderBook){return orderBook.askQty*100; },
function(orderBook){return orderBook.bidCnt; },
function(orderBook){return orderBook.bidQty*100;}



]




function fillTable() {
myAjax.getAllOrderBook(function(orderBookCompanies ) {

dwr.util.removeAllRows("oderBookbody", { filter:function(tr) {
return (tr.id != "pattern" );
}});

orderBookCompanies.sort(function(p1, p2) { return (p1.row < p2.row ? -1 :(p1.row>p2.row? 1 :p1.price>p2.price )) ;});


dwr.util.addRows("oderBookbody", orderBookCompanies, cellFunctions );

}


I hope u get some feedback from it
thanks in advance