Form refresh issue- after every refresh selected record replaced by the last record of the grid - axapta

Created extension of "SMAServiceOrderTable" form and added 2 customized view's view1 and view2 as a data source both link type "outer join" .
after changing to link type "Delayed" form issue is got solved .
but its causing slow filtration of record in list page. kindly suggest any other solution .

Related

Google Appmaker: Update form based on selected dropdown option

I have an AppMaker app that has a from based off of one address table/datasource. I can get a form with next/prev buttons, but replaced the key field (name) with a dropdown list of all names (a user can start typing names to jump there, with the dropdown showing).
My hope is that when a user selects from the dropdown, the entire form updates and the next/prev buttons work properly as well (there too many records to page thru with next/prev only). I don't have to have next/prev functionality if it complicates things too much.
Currently the dropdown is working, but I cannot get the index for the next/prev buttons set or the rest of the form to reflect the selected dropdown record.
I've tried to set the "onValueEdit" event to something like this...
var selected = widget.value;
var idx = widget.options.indexOf(selected);
console.log("Selected: "+selected+", index = "+idx+"\n");
if(idx < 0) { //...this error is never hit
console.log("Index error - setting to zero!\n");
idx = 0;
}
widget.datasource.loadPage(idx); //...update form?
Two observations via console logging:
The "idx" var is never set to the selected dropdown index reliably, and is
often "0" (tho no error msg ever shows), so the "indexOf()" function
isn't working as expected.
The "selected" var (name) is always correct.
If I call widget.datasource.loadPage(...) with a fixed value (say 5) it has no effect on what is shows in the form either (previous loaded data remains) - obviously not the way to do it :v/
Can you steer a noob in the right direction?
If you are using default App Maker form, then you can see that so-called pager, doesn't actually paginate. It triggers prevItem/nextItem datasource methods, in other words it navigates through datasource items, not pages. Here is a quote from App Maker docs:
nextItem: Selects the next item. For Query Datasources, if the current item is the last item on the page, then this loads the next page and selects the first item on the newly loaded page.
So, if you already have all your items loaded(you set query page size for your datasource to 0), then you need just to change selected item within datasource:
// onValueEdit dropdown event
// assuming, that form and dropdown share same datasource
widget.datasource.selectKey(newValue._key);
If you really have lots of items and it is not feasible to load all of them in one call... then it will be all another story...
UPDATE:
It's important that Options and Value are set as shown in the image below!
However, I had trouble setting them that way (read: wasted hours!) until I wiped them both completely using More options in the binding picklist, and tried again (I had even tried on a brand new app!). I was being forced to choose ..projections.. and then a final field before the OK button would be available.
Not sure if AppMaker is buggy here or there is something simple I'm not understanding!
None of the coding in my original question is required.
Once set this way, binding just works as you would expect it!!
All other fields are set as #datasource.item. and are bound to whatever item is chosen. No Events settings are necessary for the dropdown either, as I thought they might be.
I deleted this page and started again, and replaced the default business name data field with a drop down, I set the dropdown as:
Options: #datasources.Addresses.items
Value: #datasources.Addresses.item
It works fine?! Not sure what happend in my original page!
UPDATE:
So it seems you need to delete both the Value and Options and then re-enter these. The OK will light up when you do.
Also, my original take on App Maker was to build the UI and attach data. That was my first mistake. You build the data then have App Maker build edit/add pages for you.

Use multiple App Maker fragment forms on the same page

So if I have a customer lookup fragment form (i.e. name to lookup and displays address), then need a page with a from and to customer, is there a way to isolate the data binding so that both can be individual?
Currently I can only get the same data to show up in either and so changing one effects the other.
You can override page fragment's datasource:
Once you check 'Override page fragment datasource' checkbox, datasource property will become editable.
Ah got it! In part to what #Pavel responded with....
So in the fragment, the data source is set up pretty much normally:
In the inserted fragments, settings are as follows:
- over-ride checked
- datasource: #Datasources.Addresses.items
Both fragments now act individually on selected name.

Drupal 7: how to filter view content (with entity reference field) based on current page content

in my drupal 7 I have 2 content-types like these:
ContentA
ContentB (with a field Entity Reference to ContentA)
In the front-end detail page of ContentA, I would love to show a block/view with a list of ContentB whose Entity Reference field is set to the current ContentA.
I made a view of type Block and added it correctly to the page, but I cannot filter ContentB based on the current ContentA.
Could you help me?
Thanks
You should add a contextual filter for the value you will use for filtering to the block View of ContentB.
Then in your contextual filter in the "When the filter value is NOT in the URL" area select "Provide default value" and Type "PHP code" (You should have enable php filter for this). In your php code area you should have the following code
$node=menu_get_object();
return $node->field_your_machine_field_name['und'][0]['target_id']; // this is the field you will use for fitlering
Hope it helps
UPDATE
The above code will work if you need to show in your block similar results with the same selection (for example similar results of ContentB with the same selection in the referencing field of ContentA ).I will not delete because you might need it also in your project.I misunderstood. Actually the solution is simpler. You should add the contextual filter to the field and in "When the filter value is NOT in the URL" area select "Provide default value" and "Provide id from url"

How to create a read more link in Drupal views?

I am facing a problem in drupal views, i want to show the node body 400 character and add a read more link on after trimming. So I have trimmed the node body 400 character and put the "More link: Yes" on views. I can see the ellipsis(... after words) but not showing the link. What is the procedure to add a read more link? I am using drupal 6.22 version
Thanks in advance
A More link set to yes will send a user to a page view of that view. My typical approach to the more link is to add a field to the view for path. Then I set the path to be rewritten as More ยป.
Having the path field a the end of the view (Or at least after your body field) will give you the results you're looking for.
This is how I had done it.
In the edit of my view, I added a field node:link.
Then I removed the Label and left it empty and added "Read more" in Text to display
I checked the checkbox Trim this field to a maximum length, entered my maximum length in the textfield and checked the Add an ellipsis and Trim only on a word boundary options.
Click on Update button and save the changes. You are done!

In drupal Panels not showing appropriate content?

I created custom view using a tpl file which shows "No records found" if the query did not result any records. This works fine while looking at the preview of a view.But when i use the same view in a panel. I dont see "No records found" Its just a blank section of a panel. Why so? and how do i fix this?
Well its way too simple than i thought. Under the "basic settings->Empty Text" of a view. Write your own TEXT/HTML/PHP/ code to show it when there are no records.
information: When there are no records to display in a view and if you are using that view in a panel,it completely ignores your custom view-*-.tpl.php file and will end up showing a blank screen.
Add some text in the template file, that is always shown, to be sure, that the template is used.
Then, what is your if branch, where you check if the record list is empty?

Resources