I am using mvcgrid.net for showing my information in tables in a mvc project
How ever it is working properly I want to change
Showing 1 to 10 of 27 entries
of footer and
next and previous
texts of grid but I didn't find an API for that , Can anyone help me with this.
I am configuring my Grid as:
GridDefaults gridDefaults = new GridDefaults()
{
RenderingMode = RenderingMode.Controller,
ViewPath = "~/Views/MVCGrid/_Grid.cshtml",
NoResultsMessage = "Sorry, no results were found",
ItemsPerPage = 25,
MaxItemsPerPage = 200
};
and I update the text of anything I need in the _Grid.cshtml file or any custom View I use instead.
Custom Style
To use a custom style for your table, you can implement the IMVCGridRenderingEngine to create your table. Everything you need to populate your table will be given to you in the RenderingModel object. Once you have the implementation, set the property on your grid definition to use your new rendering engine:
gridDef.DefaultRenderingEngine = typeof(CustomHtmlRenderingEngine);
This same method could also be used to create custom export formats.
You can find it from the link.
http://mvcgrid.net/demo/customstyle
Related
I installed the computed fields modules and I'm trying to make a computed field hook for the below.
But I am not sure whether I put the code in the right place.
I just added the code below to the existing compute_field_api.php that comes with the compute field module. Is this the correct place to put this hook?
It doesn't seem to work and it doesn't display.
function computed_field_field_rating_average_compute($entity_type_manager, $entity, $fields, $delta)
{
// Get rating fields to compute
$facilities_and_services = $entity->field_facilities_and_services->value;
$fairway_rating = $entity->field_fairway_rating->value;
$recommendable_to_friends_rating = $entity->field_recommendable_to_friends->value;
$food_rating = $entity->field_food_rating->value;
$value_rating = $entity->field_value_rating->value;
$english_rating = $entity->field_english_rating->value;
$layout_rating = $entity->field_layout_rating->value;
$quality_rating = $entity->field_quality_rating->value;
$greens_rating = $entity->field_greens_rating->value;
$length_rating = $entity->field_length_rating->value;
// Set Computed field value
$value = ($facilities_and_services + $fairway_rating + $recommendable_to_friends_rating + $food_rating + $value_rating + $english_rating + $layout_rating + $quality_rating + $greens_rating + $length_rating) / 10;
return $value;
}
I tried to clear all the caches after adding this code. But it doesn't seem to work.
Had the same issue. Had to do the following:
Installed the module per the readme instructions (follow those).
Create the computed field function as you have above inside an enabled module (you may need to create a custom module for that). Note that the name of your custom module should not precede the function name (so it shouldn't be mymodule_computed_field_field_rating_average_compute, but rather as you have it above - i.e., how you've written your function is fine).
Flushed all caches.
Edit and save the node(s) where the new value should appear. That causes it to create a row in the field table.
After that, the computed value should appear in the saved content, and in views for that resaved content.
Note that it doesn't seem to be dynamic (like the old dynamic fields in D6 used to be), so it won't just magically appear for all existing content. To achieve that en-mass, I had to do a bit of back-end SQL to avoid having to manually re-save every entity (didn't want to do that for over 120 of 'em). Still figuring out if I have to do some other trickery to keep the field up-to-date despite my cache settings, as the value I'm attempting to display is dynamic, and not dependent upon the node in which the field exists...
i am using function "REUSE_ALV_GRID_DISPLAY" in order to display a grid. My problem is that not all the buttons in alv toolbar are displayed. For example, i can not see the "delete row" button.
This is my call:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = fieldcatalog
TABLES
t_outtab = lt_files_records_final
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
Can you please help?
IF you need the full editor functionality (including cell editors), you will have to move away from the (obsolete and unsupported) function module to the class CL_GUI_ALV_GRID. See the documentation here.
If you only need a delete button, it might be easier to add a custom button. Check the program SALV_DEMO_TABLE_FUNCTIONS for an example (and start using the ALV OM instead of the old function modules - much easier to code with).
The company I work for uses the Active Reports from DataDynamics to generate their reports and they asked me if I could do a web viewer of the reports where you could move the fields around.
So the way I figured I could do this was to load the empty reports (with only the fields like they appear in the designer in VS2012) in divs and use Jquery for the moves than create the report dynamically.
The thing is, I cannot find a way to access the controls of the report. I've been googling hwo to do this for a whole day but I cannot seem to find a solution.
We are using Active Reports 6, VS2012 and vb.net.
Each Section in the report has a Controls collection that reveals the collection of controls in that section. The topic on the Sections collection has a good example of how to programatically add controls to the collection. An excerpt with some comments to help explain is below:
' Insert Group Header and Footer Sections:'
Me.Sections.InsertGroupHF()
' Set some proprties to configure those sections:
CType(Me.Sections("GroupHeader1"), GroupHeader).DataField = "CategoryID"
Me.Sections("GroupHeader1").BackColor = System.Drawing.Color.SlateBlue
Me.Sections("GroupHeader1").CanGrow = True
Me.Sections("GroupHeader1").CanShrink = True
CType(Me.Sections("GroupHeader1"), GroupHeader).RepeatStyle = RepeatStyle.OnPageIncludeNoDetail
Me.Sections("GroupHeader1").Height = 0
' Create a TexBox control & Set some properties to configure that control
Dim txt As New TextBox()
txt.DataField = "CatagoryID"
txt.Location = New System.Drawing.PointF(0.0F, 0)
txt.Width = 2.0F
txt.Height = 0.3F
txt.Style = "font-weight: bold; font-size: 16pt"
' Add the TextBox to the GroupHeader section:
Me.Sections("GroupHeader1").Controls.Add(txt)
The ActiveReports 6 documentation has a walkthrough named Run Time Layouts that builds an entire application that builds a report layout in code. That's a good way to learn exactly how to manipulate a report via code.
#activescott & #Michael, the documentation links changed, but they are still available. For the ActiveReports 6 Documentation go here, and the walkthrough for Run Time Layouts is here.
I've got several XtraGrid Controls each one containing different information, I get some information about the way in which you can export a XtraGrid to an Excel file in the following direction http://www.devexpress.com/Support/Center/p/Q362120.aspx
Now Is there any way to export the each XtraGrid Control to a single Excel file so that every XtraGrid information is exported to a different excel sheet.
I tried setting the exporting path direction to the same Excel file, but when the first exporting process is done, the second exporting process just overrides the excel file and so on.
I tried using the method described in this direction XtraGrid - Export To Excel , but I wanted to know if there is another way whithout using the interop excel libraries because I have experience some problems when using this library (I mean when using this library you create an Excel process but after you created it you cannot kill it, even though you have used the method that is supposed to do that).
Any help would be welcomed.
I just wanted to provide a more complete answer, since it took a while for me to get a solution together using D..'s answer.
And yes - it looks like I'm trying to print something, but I'm just exporting to Excel, I promise.
using DevExpress.XtraPrinting;
using DevExpress.XtraPrintingLinks;
using DevExpress.XtraGrid;
class whatever
{
GridControl grid1;
GridControl grid2;
//.....
public void exportToExcel()
{
using (var saveDialog = new SaveFileDialog())
{
saveDialog.Filter = "Excel (.xlsx)|*.xlsx";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
var printingSystem = new PrintingSystemBase();
var compositeLink = new CompositeLinkBase();
compositeLink.PrintingSystemBase = printingSystem;
var link1 = new PrintableComponentLinkBase();
link1.Component = grid1;
var link2 = new PrintableComponentLinkBase();
link2.Component = grid2;
compositeLink.Links.Add(link1);
compositeLink.Links.Add(link2);
var options = new XlsxExportOptions();
options.ExportMode = XlsxExportMode.SingleFilePageByPage;
compositeLink.CreatePageForEachLink();
compositeLink.ExportToXlsx(saveDialog.FileName, options);
}
}
}
}
Hope it saves somebody a little time.
To do that you will want to add a printableComponentLink to each gridControl, and then Create a compositeLink that you can add each of the printableComponent links to.
This link may prove DevExpress KB Article may prove useful as it has an example of that.
Then you will use the compositeLink.ExportToXlsx method. If you create XlsxExportOptions with the XlsxExportOptions.ExportMode property equal to SingleFilePageByPage and pass it to the CompositeLink.ExportToXlsx method, every page will be exported to a separate sheet.
In above code, compositeLink.ExportToXlsx failed for me--no such method. Of course I am using V10.2.5, which is old. I suggest this link from the DEVXPRESS site that uses the ShowPreviewDialog method which allows exporting in a number of different formats. The link also shows how to do some customization of the output.
https://documentation.devexpress.com/#WindowsForms/clsDevExpressXtraPrintingLinksCompositeLinktopic
I like simplifying the node form. One of my tricks in the past has been to conditionally hide CCK elements on new node creation when I want to enforce some kind of default. One of my favorite tricks is to whisk away things put in place by the Prepopulate module. Unfortunately for me, it's recent move to an #after_build-based mechanism seems to be creating all kinds of collisions in how I can manipulate the widget.
This is what I used to do in hook_form_alter():
$form['field_my_nodereference_field'][0]['#type'] = 'hidden';
$form['field_my_nodereference_field'][0]['#value'] = $form['field_my_nodereference_field'][0]['#default_value']['nid'];
$form['field_my_nodereference_field'][0]['#parents'] = array('field_my_nodereference_field', 0, 'nid');
But when I try to play this game in #after_build, I run into errors with the hidden type's validation, or the nodereference_autocomplete_validation. I have resorted to conditionally adding a CSS file. This makes me sad.
Hidden is not enough. Try this one:
$form['field_my_nodereference_field'][0]['#type'] = 'nodereference_hidden';
when the type is a CCK field you have to pass this format _hidden
for instance for a simple text field I used
$form['field_srt'][0]['#type'] = 'text_hidden';
or for a filefield field I used
$form['field_myfile'][0]['#type'] = 'filefield_hidden';