Esempio n. 1
0
        public static Configurator <Toy, Row> ButtonsAndCheckboxify(this Configurator <Toy, Row> conf)
        {
            conf.Filtering();

            conf.Checkboxify(c => c.Id, SelectAllBehavior.CurrentPage, ui => ui.ResetBehavior(resetOnLoad: true));
            conf.AdjustmentTemplates("updatedRow", "updatedCell", "addedRow");


            conf.Toolbar("toolbar-rt", a =>
            {
                a.AddCommandButton(Remove.GlyphIcon() + " Remove selected", Remove)
                .DisableIfNothingChecked();

                a.AddCommandButton(Download.GlyphIcon() + " Download", Download);

                a.AddMenu("th".GlyphIcon() + "Confirmations", b =>
                {
                    b.AddCommandItem("star".GlyphIcon("left") + " Simple confirmation", Remove)
                    .Confirmation("simpleConfirmation", "#confirmationContent")
                    ;
                    b.AddCommandItem("save".GlyphIcon("left") + " Confirm selection", Remove)
                    .Confirmation("confirmationSelection", "#confirmationContent")

                    .DisableIfNothingChecked();
                    b.AddCommandItem("save".GlyphIcon("left") + " Confirm with small form", Update)
                    .Confirmation("confirmationSelectionForm", "#confirmationContent")
                    .ConfirmationForm <SimpleConfirmationModel>(c => c.WatchAllFields())
                    .DisableIfNothingChecked();
                }).Css("btn-primary");

                a.AddMenuButton("record".GlyphIcon() + " And this is button menu", "something", b =>
                {
                    b.AddSimpleItem("Simple active item").Css("active");
                    b.Separator();
                    b.AddSimpleItem("Simple inactive item");
                }).Css("btn-primary");
            });
            return(conf);
        }
Esempio n. 2
0
        public static Configurator <Toy, Row> Editor(this Configurator <Toy, Row> conf)
        {
            conf.ClientPagination();
            conf
            .DatePicker(new DatepickerOptions(     // set up functions for 3rd party datepickers
                            "createDatePicker",
                            "putDateToDatepicker",
                            "getDateFromDatepicker",
                            "destroyDatepicker"
                            ));

            conf.LoadingOverlap(ui => ui.Overlap());
            conf.LoadImmediately(true);
            conf.Column(c => c.SupplierAddress).DataOnly(false);
            conf.Column(c => c.ItemsSold).DataOnly();
            conf.Column(c => c.DeliveryDelay).DataOnly();
            conf.Column(c => c.ItemsWasInitially).DataOnly();
            conf.Column(c => c.Preorders).DataOnly();
            conf.Column(c => c.LastSoldDate).DataOnly();
            conf.Column(c => c.ResponsibleUserName).DataOnly();
            conf.Column(c => c.Price).OrderableUi(ui => ui.DefaultOrdering(Ordering.Neutral));
            conf.Column(c => c.Id).Orderable(c => c.Id, ui => ui.DefaultOrdering(Ordering.Descending));


            conf.AdjustmentTemplates("updatedRow", "updatedCell", "addedRow");

            conf.Column(c => c.Name)
            .Template(t => t.Returns(v => v.Tag("span")
                                     .Attr("style", "background-color:aliceblue")
                                     .Data("editcell", "true").Content("{Name}")
                                     ))
            .EditPlainText();
            conf.Column(c => c.CreatedDate)
            .Template(t => t.Returns(
                          v => v.Tag("div").Content(
                              c => c.Tag("span").Content("`dateFormat({CreatedDate},'dd mmm yyyy',false)`").EditPencil())))
            .EditPlainText()
            ;
            conf.Column(c => c.Price)
            .Template(t => t.Returns(
                          v => v.Tag("div").Content(
                              c => c.Tag("span").Content("{Price}").EditPencil())))
            .EditPlainText(t => t.TemplateId("plainTextEditorAlternate"))
            ;
            conf.Column(c => c.IsPaid)
            .Template(t =>
            {
                t.Returns(v => v.Tag("div").Content(c => c.Tag("span").Content("`{IsPaid}.toString() + ({^IsUpdated}?'edited':'')`").EditPencil()));
            })
            .EditCheck()
            ;
            conf.Column(c => c.SupplierAddress)
            .Template(t => t.Returns(
                          v => v.Tag("div").Content(
                              c => c.Tag("span").Content("{SupplierAddress}").EditPencil())))
            .EditMemo(c => c.Size(3, 10))
            ;

            conf.Column(c => c.TypeOfToy)
            .FormatEnumWithDisplayAttribute((tpl, v) => tpl.Content(v.Text).EditPencil())
            .EditSelectList(c => c.Items(EnumHelper.GetSelectList(typeof(ToyType))).WithEmptyElement("---Select---", false))
            ;
            return(conf);
        }