Results 1 to 2 of 2

Thread: [Solved] JSONRPC 2.0 and jsonStore

  1. #1

    Default [Solved] JSONRPC 2.0 and jsonStore

    I've programmed a XML-RPC server for some client tools on local machines. The XML-RPC server calls the right PHP script on the server (methods) for the user and give the client a XMl-RPC response back. Now we want to build some tools in ExtJS to become platform independed. Well we first programmed a XML-RPC client between the jsonstore and the XML-RPC server (for beta version). Now we programmed a JSON-RPC server next to the XML-RPC server. Depending on the content type of the requested page the right server will be used. and will also output the content in the right format. The problem between JSON-RPC and the jsonStore is that the difference in format. We output something like this from the server:

    {"jsonrpc": "2.0", "result": {"propertylist1":["item 1","item 2","item 3","item 4"],"propertylist 2":["item 1","item 2","item 3","item 4","item 5"],"propertylist 3":["item 1","item 2","item 3","item 4","item 5","item 6","item 7"],"propertylist 4":["item 1","item 2","item 3"],"propertylist 5":["item 1","item 2"]}, "id": 4}

    This result in XML-RPC format will be used in other software to load a group of 5 popup buttons (combo boxes). Without changing the methods nor deviating from the jsonrpc 2.0 standard I want to know how I can load this data also in the right combo boxes in ExtJS. I tried with a jsonStore to set the root to 'result.propertylist1' but that won't work either. I see 4 empty items in the list but has no value . I'm not sure if jsonstore is the right solution so I was wondering what you guys think it's the best thing to do here.

    Note: the methods on the server can't be changed because already hundreds of methods is in use with other client software.


  2. #2


    I've got the problem solved.

    I use one json store and the stores to the combo boxes are empty arrays. Then I added a handler when the store is loaded. Then I'll populate the combo boxes with arrays with loadData().

    Something like this works now

    var mainStore = new{
                    autoDestroy: true,
                    url: '<?php echo $_SERVER['PHP_SELF'];?>?',
                    storeId: 'mainStore',
                    root: 'result', //is the root from JSONRPC
                    idProperty: 'propertylist1', //can be any field, we don't use this
                    fields: ['propertylist1', 'propertylist2', 'propertylist3', 'propertylist4', 'propertylist5']
                 mainStore.on('load', function(theStore, records, options){
                var cmb1 = new Ext.form.ComboBox({
                    allowBlank: false,
                    mode: 'local',
                    editable: false,
                    emptyText: 'Select value',
                    forceSelection: true,
                    store: [],
                    triggerAction: 'all',
    ...same for all those other comboboxes
    at last ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts