mvcgrid.net unable to use toolbar - asp.net

I'm working on a website with a feature that can sort users.
I'm using mvcgrid.net libs but I can't figure it out. the toolbar doesn't work.
I used most of the basic source codes from mvcgrid.net but when i press something in the search bar it doesn't work or the items per page selection.

If you have specific code to take a look at, please post. Otherwise, here are a few things you can check:
(1) Be sure you've applied the mvcgrid data attributes needed. For example, for a search field you might have these attributes:
<input
type="search"
data-mvcgrid-apply-additional="change"
data-mvcgrid-type="additionalQueryOption"
data-mvcgrid-option="search"
data-mvcgrid-name="ContactGrid">
(2) Be sure the value you chose for mvcgrid-option (in this example, "search") is then added when you configure the grid. For example:
MVCGridDefinitionTable.Add("ContactGrid", new MVCGridBuilder<ContactViewModel>(defaults)
.WithAdditionalQueryOptionNames("Search")
...
(3) You then need to read the attribute (again in the grid config) in your .WithRetrieveDataMethod()
string search = options.GetAdditionalQueryOptionString("search");
I've forgotten step 2 in the past -- that's generally what has tripped me up.

Related

How can I automate data extraction in this website? (can't see query options, if any)

I want to extract election results from this website (currently all data is at zero because voting is ongoing). In the menu you can select the data you want (I need "En Chile" -> "División Geográfica" -> "Comunas"). This is the voting results for each municipality ("comuna"). When you select the desired "comuna", then you can click the excel file and results are downloaded.
The "problem" is that no url is shown along the process. I cannot see the url link to the particular "comuna" I need. I was hoping to get a specific link so then I can automate using wget with the name of each municipality. Instead, the data seems to be masked. I know you can extract JSON data, perhaps using the properties shown in the website's HTML code:
<select class="form-control" id="selComunas" ng-model="comuSelected"
ng-options="item.d for item in comunas" name="comunas"
ng-show="(vistaVertical==='G' || vistaVertical==='E') && subMenu === null"
ng-change="updateComuna()">
<option value="">Comunas...</option>
</select>
But where to make the call? No idea. Also, I see no link to the excel file in the HTML. Stuff seems to be masked inside "ng" elements, which seems to be AngularJS, as far as I can read online. No idea how to proceed. As you can see, I'm noob on this. Any help is more than welcome.
Open chrome dev tools and look for something useful there while clicking on the UI
http://www.servelelecciones.cl/data/elecciones_constitucion/filters/comunas/all.json
This link returns all communas with their ids
[{"c":2564,"d":"ALGARROBO"},{"c":2801,"d":"ALHUE"},{"c":2674,"d":"ALTO BIOBIO"},...
Next thing, when we select value from dropdown, we get another link in network tab. Number in the end matches, isn't it?
http://www.servelelecciones.cl/data/elecciones_constitucion/computo/comunas/2570.json
"d":"Integer",
"e":"Integer",
"f":"Integer",
"sd":null
},
"data":[
{
"a":"Apruebo",
"b":null,
"c":"0",
"d":"0,00%",
"e":null,
"f":"",
"sd":null
},
{
"a":"Rechazo",
"b":null,
"c":"0",
"d":"0,00%",
"e":null,
"f":"",
"sd":null
}
From this point you can process JSON directly by whatever programming language you use

Is it possible to show all options in Tokenize2?

Tokenize2 is a javacsript lib to select multiple options.
It provides a very neat UI to start writing and then get a list of options to select from. Selected options will show up as "tags" that can be removed with "x" link.
So far all is fine. But Right now you need to know what your looking for and start write at least one character to see matching alternatives.
In my scenario there are very few alternatives and they are not known to the user. I would like to show ALL options when the user clicks the input box. There is a configuration option named searchMinLength but it is already set to 0.
Is there a workaround that can be used? Maybe like triggering load and dropdown manually?
I know there are a lot of similar alternatives but I picked Tokenize2 because:
It looks clean and nice
It works in mobile browsers
I don't know if there is an "official" approach, but after some investigation I have found an acceptable workaround.
After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:
if(this.input.val().length > 0){
this.trigger('tokenize:search', [this.input.val()]);
}
My interpretation is that the internal search command is not triggered unless the user input has at least one character. This line in sourcecode could easily be modified. I have filed a suggestion for this here: https://github.com/zellerda/Tokenize2/issues/26
My current workaround is to add an event listener for the select event and there trigger the internal search command. That works fine for my scenario and does not force a source code rewrite.
$("#my-dropdown").on("tokenize:select", function (e: Event, routedEvent: boolean) {
$("#my-dropdown").trigger('tokenize:search', "");
});
Tokenize2
This link worked for me GitHub
$('.tokenize-sample-demo1').on('tokenize:select', function(container){
$(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
});

Error while build on Simple List form in AX7

I faced one issue while building Simple List form in AX7. I added all missing controls on form still its giving below error on build.
Pattern 'Simple List' requires a sub-pattern specified on control 'AXForm/Form name//Design/Controls/CustomFilterGroup'.
If you have an error informing you, that you have missing sub-pattern you should search for "unspecified" in the Form Designer. This search will show you all nodes where you have a missing sub-pattern.
For me this seems the easiest way to find all places where there is still work to be done in the Form. By work to be done, I mean to apply a fitting sub-pattern.
Here is an example:
After analyzing the new changes in AX7, I found that we also need to apply sub-patterns on Custom Filters in Simple List form pattern otherwise form will not build successfully. So to apply sub patterns on custom filter group , right click on group, select apply pattern and then click on Custom and Quick Filters. This will apply sub patterns to custom filters and you will be able to successful build the form.
you can use "form statistics". its show, how many object covered by patterns and there is left any unspecified object.
to do this: open form, right-click the form in the designer, and then select Addins > Form statistics.
its looks like: http://msdynamics.blob.core.windows.net/media/2015/09/formStatistics.png
source: https://ax.help.dynamics.com/en/wiki/form-styles-and-patterns/

Filter at event viewer by data

I want to get event entries by their description (data).
I know how to get the event entry with a certain description, however I want to get an entry whith a description which contains a string (not equals to it).
That, I don't know how to do.
Please help :)
According to my answer here: https://stackoverflow.com/a/34119006/5089204 you should be able to retrieve EventRecords.
Dealing with these events is a quite complex issue... Each event has its own internal structure. The common properties are bundled in EventRecord, but the specific data must be taken from the internal details. Use the ToXml() method of an EventRecord...
In order to get the right events you must define an EventLogQuery. You must know the Provider's name and specify the filter.
Try the following: Open eventvwr and there the Windows-System queue. Right click one event, open the "Details" and choose the "XML-View". Look over different events and you will find, that they are quite differing.
But: You'll find everything you need there: First the "Provider Name" and the "EventId", these two are most important for the `EventLogQuery'.
Now go to the "define a user filter on the current protocoll"-action and type in some values. Then switch to the filter's XML and you'll learn how to define the correct query.
I'm sorry, there is no "easy and general" approach :-)

How to restrict text length of a field while in WordPress editor?

I would like to restrict the fields while creating a new post in WordPress. For the title, it should not exceed 40 characters. For the content, it should not exceed 400 characters. If these maximum values are exceeded, I would like to show an error message and not let the user continue. How do I do that in WordPress?
You should be able to use wordpress filters to modify the code that gets outputted when the editor is called. Essentially you would want to use it to insert some javascript and an extra div tag to display your error, then just read the contents of the "editorcontainer" id and show the error once it reaches a certain character limit.
I don't have the time at the moment to write a case example, but depending on your skill level, the functions you are looking for are:
apply_filters("the_editor", "customfunction_limitarea");
Where customfunction_limit area is your created function to insert the javascript. You can see how the_editor is currently called and how the default filters are applied in "wp-includes\general-template.php" on line 1822. The default looks like this:
$the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea rows='$rows'$class cols='40' name='$id' tabindex='$tab_index' id='$id'>%s</textarea></div>\n");
I would try modifying that statement by placing a new filter in a functions.php file located in your themes directory, that way you don't have to worry about it getting over-written during an update. Otherwise, if you absolutely have to edit the wordpress core (generally a no-no), general_template.php would be the place to do it I think.
Essentially just read up on wordpress filters a little bit (be warned there's not a ton of documentation or examples available for it other than the basic stuff), and that should provide everything you need. The input verification end is easy enough to find scripts, just google jquery post limiting. Something like this might be exactly what your looking for:
http://swiki.fromdev.com/2010/02/jquery-maximum-limit-texttextarea-with.html

Resources