1) Entry Point is as follows:
2) Response Format: Servlet returns response in application/xml format in following format.
3) although this code works with smart client grid. Which is as follows:
Code:
RestDataSource jDs = new RestDataSource(); jDs.setDataFormat(DSDataFormat.XML); jDs.setDataURL("/VOIPA/search?action=query&product=icp&queryname=confirmcount&format=xml&count=10"); jDs.setRecordXPath("/response/data/record"); OperationBinding fetch = new OperationBinding(); fetch.setOperationType(DSOperationType.FETCH); fetch.setDataProtocol(DSProtocol.POSTMESSAGE); jDs.setOperationBindings(fetch); DataSourceField summary = new DataSourceField("MESSAGETYPE", FieldType.TEXT); DataSourceField title = new DataSourceField("REQUESTNUMBER", FieldType.TEXT); jDs.addField(summary); jDs.addField(title); final SearchForm form = new SearchForm(); form.setTop(50); form.setNumCols(3); TextItem query = new TextItem(); query.setName("count"); query.setTitle("Query"); query.setDefaultValue("10"); final ListGrid myGrid1 = new ListGrid(); myGrid1.setWidth("100%"); myGrid1.setHeight(100); myGrid1.setWrapCells(true); myGrid1.setFixedRecordHeights(false); myGrid1.setShowAllRecords(true); myGrid1.setAlternateRecordStyles(true); myGrid1.setDataSource(jDs); ButtonItem button = new ButtonItem(); button.setTitle("Search"); button.setStartRow(false); button.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { myGrid1.fetchData(form.getValuesAsCriteria()); } }); form.setItems(query, button); VLayout layout = new VLayout(15); layout.addMember(myGrid1); layout.addMember(form); layout.draw();
Code:
<response> <status>0</status> <startRow>0</startRow> <endRow>15</endRow> <totalRows>15</totalRows> <data> <record> <MESSAGETYPE>MultiPortResponse</MESSAGETYPE> <REQUESTNUMBER>6017008336100040</REQUESTNUMBER> </record> <record> <MESSAGETYPE>StoreStatus</MESSAGETYPE> <REQUESTNUMBER>6017008336100040</REQUESTNUMBER> </record> </data> </response>
Code:
isc.DataSource.create ({ dataURL:"http://impetus-861:9696/VOIPA/search?action=query&product=icp&queryname=confirmcount&format=xml", dataFormat: "xml", recordXPath:"/response/data/record", fields: { REQUESTNUMBER:{title:"REQUESTNUMBER", name:"REQUESTNUMBER", required:true, type:"text"}, MESSAGETYPE:{title:"MESSAGETYPE", name:"MESSAGETYPE", required:true, type:"text"} }, ID:"test" }); isc.ListGrid.create ({ ID: "submittedOrders", top:10,left:20, width:920, height:130, alternateRecordStyles:true, showAllRecords:true, showRollOver : true, showHover : true, editEvent: "click", dataSource: test, fields: [ {name:"REQUESTNUMBER", title:"REQUESTNUMBER", canEdit:false, width: 110, align: "center",recordClick:"getOrderDetail(record)"}, {name:"MESSAGETYPE", title:"MESSAGETYPE", canEdit:false, width: 125 , align: "center"} ], autoFetchData: true, canReorderFields: true, getCellCSSText: function (record, rowNum, colNum) { if (colNum == 0) { return "font-weight:bold; color:blue; text-decoration: underline;"; } } })
Comment