1

I am new to Web UI, Dojo, Java etc. If you are referring any advance topic please give some reading reference. It will help.

Context:

  1. I have Gridx design using JsonStore, which takes a target + id for URL. With fixed "id" Grid loads well.

  2. I have Dynamic Tree. It is working fine with lazy-loading etc.

Objective:

Based on click (or dblclick) event for a given node in Tree, I have to load Gridx with data. Hence, if tree node "id":7 is clicked, then JsonStore: /target/7 should be fetched and get loaded in Gridx.

Issues:

  1. As you can guess, at start there is no valid "id" property to fill in JsonStore. In click event handler of tree, I will get this value, upon a user click. Hence, can't call gridx.startup() in "ready". Though I have "placed" the widget in "ready".

  2. Hence, I have following snippet to handle, <


  // this function is called from tree event handler
function LatestTabGridxLoad( id ) {
    console.log( "ID %s fetched.", id );
    LatestTabGridxStore.idProperty = id;
    LatestTabGridx.startup();
    LatestTabGridx.body.refresh();
}

ready(function()
{
    TabLatestAssetTree.startup();
    LatestTabGridx.placeAt( "ReportMiddleTabLatestCenterContainer" );
}

Now, trouble is, at first time loading, JsonStore GET fired with /target/ alone, without any "id" without any user click. Hence, server responds with 405. Subsequently, when user clicks, again same HTTP GET without "id" results in HTTP 405. I am not able to somehow feed "id" to the GET URL. I have checked JSON, it is in perfect shape, as it works in standalone table, that is declarative(ly) defined.

Please suggest me ways to link a TREE node through its "id" to Gridx. Also suggest, if approach I am taking is right way to solve this problem.

Danubian Sailor
  • 1
  • 38
  • 145
  • 223

1 Answers1

0

Sorry, misunderstanding of the question. I thought it was about gridx tree but it is about regular gridx controlled by another widget.

The problem is in this line:

console.log( "ID %s fetched.", id ); LatestTabGridxStore.idProperty = id;

'idProperty' is the name of the JSON attribute which stores the ID. This will not change with each selection. If it is not set, JsonStore will assume it to be 'id'. What you intended to do was to modify the target property of the store to include the ID. This can done directly and will look something like the following (details are application specific)

LatestTabGridxStore.target = (someURL) + '/' + id;

After that, the content of gridx needs to be replaced using the new store setting. There are few ways to do it, the simplest being destroying the current gridx instance and replacing it with another one which uses the altered store.

janh
  • 1
  • 1
  • Please don't use answers to comment, ask for help or say somehting like "Hey I have this problem too" therefore, this was posted as an answer, but it does not attempt to answer the question. It should possibly be an edit, a comment, another question, or deleted altogether. – Fabio Antunes Nov 03 '13 at 17:22