Hi,

In my assumption, I want to directly receive the data from server without throught the Table. That is to say, I just want to handle the original data from sever and undefine the schema and group. Is this a logical assumption? If yes, how can I capture the server map data without the schema and group?

I puerilely wrote the following test code:

/////////////////////////////////////////////////////////////////////
var myTable = new NonVisualTable("","","MERGE");//Empty the group and schema
myTable.setSnapshotRequired(true);
myTable.onItemUpdate = function(item, itemUpdate) {
......
}
lsPage.addTable(myTable,"test");
/////////////////////////////////////////////////////////////////////

The test result is failed as my forecast.

Is there any other ways for this assumption?

Thanks for any ideas!

Best Regards,
Johnny Yau
The items and fields related to a table are decided server side by the MetadataProvider.
When you subscribe a table you're not sending to the server item and field names, but a group name and a schema name.
Usually group and schema names are composed by space-separated item and field names. This special case is handled by the LiteralBasedProvider that is a MetadataProvider implementation distributed with the server.
If you implement your own MetadataProvider class (maybe extending an existing one)
you can completely change this logic implementing two methods: getItemsand getSchema.

Look the following example. I will use "ALL" as group name and I will be returned with the 30 items of the StockListDemo.

First I change the adapters.xml file of the classic StockListDemo as follows (note that the only difference is the metadata_provider class name:
[syntax="XML"]<?xml version="1.0"?>
<adapters_conf id="STOCKLISTDEMO">
<metadata_provider>
<adapter_class>com.lightstreamer.meta.allmeta.AllMetaExample</adapter_class>
<param name="item_family_1">item.*</param>
<param name="modes_for_item_family_1">MERGE</param>
</metadata_provider>

<data_provider>
<adapter_class>com.lightstreamer.adapters.stocklist_demo.DemoDataAdapter</adapter_class>
</data_provider>
</adapters_conf>
[/syntax]

This is the AllMetaExampleimplementation:
[syntax="JAVA"]
package com.lightstreamer.meta.allmeta;

import com.lightstreamer.adapters.metadata.LiteralBasedProvider;

public class AllMetaExample extends LiteralBasedProvider {

private static String[] completeList = new String[30];

static {
for (int i = 0; i < 30; i++) {
completeList = "item" + (i+1);
}
}

public AllMetaExample() {
super();
}

public String[] getItems(String user, String groupName) {
if (groupName.equals("ALL")) {
return completeList;
} else {
//other logic to handle different group names
return null;
}
}

}
[/syntax]

and finally a simple client:
[syntax="HTML"]<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Lightstreamer StockList Demo</title>
<script language="JavaScript" src="/LS/lscommons.js"></script>
<script language="JavaScript" src="/LS/lspushpage.js"></script>
<link rel="stylesheet" type="text/css" href="css/table.css" />
</head>

<body>
<table cellspacing="0" cellpadding="10" border="0" >
<script>

for (var i = 1; i <= 30; i++) {
var suff = (i % 2 == 1) ? "A" : "B";
document.write('<tr class="lscold'+suff+'">');
document.write('<td nowrap style="text-align: left"><div class="stockname'+suff+'" source="lightstreamer" table="1" item="'+i+'" field="stock_name">Loading...</div></td>');
document.write('<td><div source="lightstreamer" table="1" item="'+i+'" field="time">-</div></td>');
document.write('<td><div source="lightstreamer" table="1" item="'+i+'" field="last_price">-</div></td>');
document.write('</tr>');
}
</script>

</table>

<script>

/////////////////PushPage Configuration

var lsPage = new PushPage();
var debugAlerts = false;
var remoteAlerts = false;
var pushHost = null;
var pushPort = null;
var useDomain = null;

lsPage.context.setDomain(useDomain);
lsPage.context.setDebugAlertsOnClientError(debugAlerts);
lsPage.context.setRemoteAlertsOnClientError(remoteAlerts);

lsPage.onEngineCreation = function(lsEngine) {
lsEngine.context.setDebugAlertsOnClientError(debugAlerts);
lsEngine.context.setRemoteAlertsOnClientError(remoteAlerts);

lsEngine.connection.setLSHost(pushHost);
lsEngine.connection.setLSPort(pushPort);
lsEngine.connection.setAdapterName("STOCKLISTDEMO");

lsEngine.changeStatus("STREAMING");
}

lsPage.bind();
lsPage.createEngine("SLEngine","/LS/","NEW_SESSION");

///////////////////////Table configuration

var allTable = new OverwriteTable("ALL", null, "MERGE");
allTable.setSnapshotRequired(true);
lsPage.addTable(allTable, "1");

</script>
</body>

</html>
[/syntax]

Note that once you give to the Table constructor a String instead of an Array (as in this case) you can't no more acces items by name but you must handle item indexes.
Some useful links:
http://www.lightstreamer.com/docs/client_web_jsdoc/Table.html#Table()
http://www.lightstreamer.com/docs/client_web_jsdoc/UpdateItemInfo.html
http://www.lightstreamer.com/vb/showthread.php?t=49&highlight=LiteralBasedProvider

Please check the FileBasedProvider before starting implement your own MetadataProvider. Maybe it already fit your needs.

Hope that helps.
PS: the null passed as group and/or schema name does not mean to give to you everything, but means "get the item and field names from the html template that will contain the updates". Obviously this is not possible with a NonVisualTable and is suitable only for LiteralBasedProvider-like MetadataAdapters.
sorry, but I don't understand why you want to use null as schema and group name.
Isn't my example suitable for your needs?
My project tearm have choosen the push technology - pushlet before I join. Now the performance is not suitable for the customer requirements. So we focus on the lightstreamer. But the pushlet web client development have been completed. I want to establish an adapter between pushlet and lightstreamer. I have completed the server-side codes, but broken by the group and schema. If can pass null as group and schema name on NonVisualTable, I will finish the switch workload and suggest to purchase the commercial edition lightstreamer. Of course, I also can suggest for project term to rewrite the client codes. I think it is not a very difficult matter :Smile_Ab:

Thanks for your useful help. I have got a short cut for the lightstreamer.

cheers
Ok, I understand,
but just customizing the MetadataProvider and use a custom string instead of the null value should not be a big change unless you already have a custom MetadataProvider incompatible with such approach.

Let me know if you need further info.
7 days later
I fixed it by passing a constant string as group and schema name!

Can the lightstreamer server push data to the appointed client that known by the DataProvider? And is there a clientid to identify the client connection?

Thanks!
3 years later
Hi everybody.
Please, in the case where i have this in AllMetaExample
public class AllMetaExample extends LiteralBasedProvider {

    private static String[] completeList;
    
    static {
            completeList[] = geFromDB();
    }

    private String[] geFromDB(){
             .........
    }
}
So, how can i know the number of elements that i will be subscribed to from the client ?
What will i put in this HTML line:
for (var i = 1; i <= [COLOR="Red"]???[/COLOR] ; i++) {
Or should i use a DynaScrollTable ? Or can i still use OverwriteTable ?
Currently, the number of items corresponding to the expansion of a symbolic group name is not communicated by the Server to the client.
We always assume that the client knows in advance the meaning of the symbolic group names it submits to the Server,
so that it has already been able to provide the suitable space on the page for displaying the value before subscribing.

For any case of management of lists of unknown length, the COMMAND mode and the DynaMetapushTable were provided.
Note that the DynaScrollTable, combined with DISTINCT, mode also displays variable length lists, but it doesn't allow you to update the values, only to grow the list.

Otherwise, application level mechanisms have to be leveraged; for instance, you could subscribe to an item which provides the list length.